0

I'm trying out citus (docker-compose based on tutorial, 2 worker nodes). If I create a table and don't execute create_distributed_table the table is only created in the coordinator which seems to be according to the documentation, however, once I run create_distributed_table and connect to coordinator and worker nodes, the table is present in all (with all rows) and with the actual table name (no table_name_shardid).

If I run the following query though:

SELECT
    shardid,
    node.nodename,
    node.nodeport
FROM pg_dist_placement placement
JOIN pg_dist_node node
  ON placement.groupid = node.groupid
 AND node.noderole = 'primary'::noderole
WHERE shardid = 102056;

I get the shard should only be present in one of the nodes:

102056 "worker1b" 5432

Running select * from citus_get_active_worker_nodes() on coordinator I get:

"worker2a" 5432

"worker1b" 5432

1 Answers1

0

Citus masks shard tables. To be able to query them, this is required:

Run select * from citus_shards to identify the shard table name

Then: https://docs.citusdata.com/en/latest/develop/api_guc.html#citus-show-shards-for-app-name-prefixes-text

Then we can query the shard table.