Checking a Node Where a Table Resides
When creating a table, you can specify how the table is distributed or replicated among nodes. For details, see •DISTRIBUTEBY. For details about distribution modes, see Selecting a Distribution Mode.
When creating a table, you can also set Node Group to specify a group to which the table belongs. For details, see •TO{GROUPgroupname|....
You can also run the following command to view the instance where the table is located.
- Query the schema to which the table belongs.
select t1.nspname,t2.relname from pg_namespace t1,pg_class t2 where t1.oid = t2.relnamespace and t2.relname = 'table1';
In the preceding command, nspname indicates the name of a schema, relname indicates the name of a table, an index, or a view, oid indicates the row identifier, relnamespace is the OID of the namespace that contains the relationship, and table1 indicates a table name.
- Check relname and nodeoids of the table.
select t1.relname,t2.nodeoids from pg_class t1, pgxc_class t2, pg_namespace t3 where t1.relfilenode = t2.pcrelid and t1.relnamespace=t3.oid and t1.relname = 'table1' and t3.nspname ='schema1';
In the preceding command, nodeoids indicates the OID list of the nodes where the table is distributed, relfilenode indicates the name of the file related to the table on the disk, pcrelid indicates the OID of the table, and schema1 indicates the schema of the table queried in step 1.
- Query the instance where the table is located based on the queried node where the table is distributed.
select * from pgxc_node where oid in (nodeoids1, nodeoids2, nodeoids3);
In the preceding command, nodeoids1, nodeoids2, nodeoids3 indicates the three nodeoids queried in step 2. Use the actual nodeoids and separate them with commas (,).
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot