@@ -172,7 +172,7 @@ on shardlord with usual `CREATE TABLE` DDL and execute
172
172
` shardman.create_hash_partitions ` function, for example
173
173
174
174
``` plpgsql
175
- CRATE TABLE horns (id int , branchness int );
175
+ CRATE TABLE horns (id int primary key , branchness int );
176
176
select create_hash_partitions(' horns' , ' id' , 30 , redundancy = 1 )
177
177
```
178
178
@@ -181,7 +181,7 @@ On successfull execution, table `horns` will be hash-sharded into 30 partitions
181
181
replica will be spawn and added to logical replication channel between nodes
182
182
holding primary and replica.
183
183
184
- After table was sharded, each ` pg_shardman ` node can execute any DML statement
184
+ After table was sharded, each ` pg_shardman ` worker node can execute any DML statement
185
185
involving it. You are free to issue queries involving data from more than one
186
186
shard, remote or local. It works using standard Postgres inheritance mechanism:
187
187
all partitions are derived from parent table. If a partition is located at some
@@ -194,6 +194,9 @@ on all nodes in parallel: foreign data wrappers do not support parallel scan
194
194
because of using cursors. Execution of OLAP queries at ` pg_shardman ` might not
195
195
be that efficient. ` pg_shardman ` is oriented mainly on OLTP workload.
196
196
197
+ Shardlord doesn't hold any data and can't read it, this node is used only for
198
+ managing the cluster.
199
+
197
200
Presently internal Postgres function is used for hashing; there is no easy way
198
201
for client app to determine the node for particular record to perform local
199
202
reads/writes.
@@ -249,6 +252,10 @@ We don't track replication mode for each table separately, and changing
249
252
` shardman.sync_replication ` GUC during cluster operation might lead to a mess.
250
253
It is better to set it permanently for now.
251
254
255
+ ` pg_shardman ` currently doesn't bothers itself with configuring replication
256
+ identities. It is strongly recommended to use primary key as sharding key to
257
+ avoid problems with ` UPDATE ` and ` DELETE ` operations.
258
+
252
259
### Balancing the load
253
260
254
261
Newly added nodes are initially empty. To bring some sense into their existence,
@@ -388,8 +395,11 @@ also create new indices. It must be done per each partition separately,
388
395
see
389
396
[ pathman docs] ( https://github.com/postgrespro/pg_pathman/wiki/How-do-I-create-indexes )
390
397
398
+ ` monitor ` function on shardlord can continiously track failed nodes and resolve
399
+ distributed deadlocks, see the reference.
400
+
391
401
If shardlord has failed during command execution or you just feel that something
392
- goes wrong, run ` shadman .recover()` function. It will verify nodes state
402
+ goes wrong, run ` shardman .recover()` function. It will verify nodes state
393
403
against current shardlord's metadata and try to fix up things, i.e. reconfigure
394
404
LR channels, repair FDW, etc.
395
405
@@ -505,6 +515,9 @@ more than one copy of the partition per node. Distributed table is always
505
515
created empty, it doesn't matter had the original table on shardlord had any
506
516
data or not.
507
517
518
+ Column(s) participating in ` expr ` must be marked ` NOT NULL ` , as in
519
+ ` pg_pathman ` . Generally we strongly recommend to use primary key there.
520
+
508
521
``` plpgsql
509
522
rm_table(rel_name name)
510
523
```
@@ -640,7 +653,7 @@ Data is not touched by this command.
640
653
## Some limitations:
641
654
* You should not touch ` synchronous_standby_names ` manually while using pg_shardman.
642
655
* The shardlord itself can't be worker node for now.
643
- * All [ limitations of ` pg_pathman ` ] ( https://github.com/postgrespro/pg_pathman/wiki/Known-limitations ) ,
656
+ * All [ limitations] ( https://github.com/postgrespro/pg_pathman/wiki/Known-limitations ) (and some features) of ` pg_pathman ` ,
644
657
e.g. we don't support global primary keys and foreign keys to sharded tables.
645
658
* All [ limitations of logical replications] ( https://www.postgresql.org/docs/10/static/logical-replication-restrictions.html ) .
646
659
` TRUNCATE ` statements on sharded tables will not be replicated.
0 commit comments