C.6. Useful Functions and Tables #

C.6.1. How do I see which tables and sequences are distributed? #

Here are lists of some useful internal Shardman tables.

  • shardman.sequence — the list of global sequences

  • shardman.sharded_tables — the list of sharded tables

  • shardman.global_tables — the list of global tables

For example:

postgres=# select * from shardman.sequence;
 seqns  | seqname | seqmin |       seqmax        | seqblk 
--------+---------+--------+---------------------+--------
 public | s       |      1 | 9223372036854775807 |  65536
(1 row)

postgres=# select * from shardman.sharded_tables;
  rel  | nparts | colocated_with | relname | nspname 
-------+--------+----------------+---------+---------
 16648 |     20 |                | d       | public
 16741 |     20 |          16648 | c       | public
(2 rows)

postgres=# select * from shardman.global_tables; 
 relid | main_rgid | relname | nspname 
-------+-----------+---------+---------
 16636 |           | g       | public
(1 row)
    

C.6.2. How do I execute some SQL command on all nodes in the cluster? #

To do this, use the shardman.broadcast_all_sql function and shardmanctl forall option. For example:

postgres$ shardmanctl forall --sql "select name,setting from pg_settings where name = 'max_connections'"
SQL: select name,setting from pg_settings where name = 'max_connections'
Node 1 says:
[max_connections 90]
Node 2 says:
[max_connections 90]
    

C.6.3. How do I get Shardman configuration parameters on a selected node? #

The standard SHOW command can be used to obtain Shardman-specific parameters that are listed in the section.

Besides, you can use shardmanctl config get command to obtain cluster configuration from etcd. You can view the parameters, but it is better to customize them after consulting with Posgres Pro engineers.

C.6.4. How do I update Shardman configuration parameters? #

You can use shardmanctl config update functionality, see an example.

pdf