-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ test: single_shard_joins | |
test: multishard | ||
test: error | ||
test: routing_hint | ||
test: distinct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
\c spqr-console | ||
|
||
SQPR router admin console | ||
Here you can configure your routing rules | ||
------------------------------------------------ | ||
You can find documentation here | ||
https://github.com/pg-sharding/spqr/tree/master/docs | ||
|
||
ADD SHARDING RULE t1 COLUMNS id; | ||
add sharding rule | ||
---------------------------------------------------------------------- | ||
created sharding rule t1 for table (*) with columns [id, hash: x->x] | ||
(1 row) | ||
|
||
ADD KEY RANGE krid1 FROM 1 TO 11 ROUTE TO sh1; | ||
add key range | ||
-------------------------------- | ||
created key range from 1 to 11 | ||
(1 row) | ||
|
||
ADD KEY RANGE krid2 FROM 11 TO 101 ROUTE TO sh2; | ||
add key range | ||
---------------------------------- | ||
created key range from 11 to 101 | ||
(1 row) | ||
|
||
\c regress | ||
CREATE TABLE test_dist(id int); | ||
NOTICE: send query to shard(s) : sh1,sh2 | ||
INSERT INTO test_dist(id) VALUES(5); | ||
NOTICE: send query to shard(s) : sh1 | ||
INSERT INTO test_dist(id) VALUES(5); | ||
NOTICE: send query to shard(s) : sh1 | ||
INSERT INTO test_dist(id) VALUES(5); | ||
NOTICE: send query to shard(s) : sh1 | ||
INSERT INTO test_dist(id) VALUES(5); | ||
NOTICE: send query to shard(s) : sh1 | ||
INSERT INTO test_dist(id) VALUES(5); | ||
NOTICE: send query to shard(s) : sh1 | ||
SELECT id FROM test_dist WHERE id=5; | ||
NOTICE: send query to shard(s) : sh1 | ||
id | ||
---- | ||
5 | ||
5 | ||
5 | ||
5 | ||
5 | ||
(5 rows) | ||
|
||
SELECT DISTINCT id FROM test_dist WHERE id=5; | ||
NOTICE: send query to shard(s) : sh1 | ||
id | ||
---- | ||
5 | ||
(1 row) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
\c spqr-console | ||
|
||
ADD SHARDING RULE t1 COLUMNS id; | ||
ADD KEY RANGE krid1 FROM 1 TO 11 ROUTE TO sh1; | ||
ADD KEY RANGE krid2 FROM 11 TO 101 ROUTE TO sh2; | ||
|
||
\c regress | ||
|
||
CREATE TABLE test_dist(id int); | ||
INSERT INTO test_dist(id) VALUES(5); | ||
INSERT INTO test_dist(id) VALUES(5); | ||
INSERT INTO test_dist(id) VALUES(5); | ||
INSERT INTO test_dist(id) VALUES(5); | ||
INSERT INTO test_dist(id) VALUES(5); | ||
SELECT id FROM test_dist WHERE id=5; | ||
SELECT DISTINCT id FROM test_dist WHERE id=5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters