Skip to content

Commit

Permalink
chore: adjust style
Browse files Browse the repository at this point in the history
Signed-off-by: mlycore <[email protected]>
  • Loading branch information
mlycore committed Dec 14, 2023
1 parent 8c42c93 commit 33fcf38
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions solutions/stackgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ postgres=> CREATE DATABASE sharding_db;
postgres=> \c sharding_db;

# Register storage units
postgres=> REGISTER STORAGE UNIT ds_0 (HOST="cluster-1.sg-demo", PORT=5432, DB="postgres", USER="postgres", PASSWORD="5bc0-07f8-40b3-b81"),ds_1(HOST="cluster-2.sg-demo", PORT=5432, DB="postgres", USER="postgres", PASSWORD="700e-33b3-4edf-bde");
sharding_db=> REGISTER STORAGE UNIT ds_0 (HOST="cluster-1.sg-demo", PORT=5432, DB="postgres", USER="postgres", PASSWORD="5bc0-07f8-40b3-b81"),ds_1(HOST="cluster-2.sg-demo", PORT=5432, DB="postgres", USER="postgres", PASSWORD="700e-33b3-4edf-bde");

# Create sharding table rule
postgres=> CREATE SHARDING TABLE RULE t_order(STORAGE_UNITS(ds_0,ds_1),SHARDING_COLUMN=order_id,TYPE(NAME="hash_mod",PROPERTIES("sharding-count"="2")),KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME="snowflake")));
sharding_db=> CREATE SHARDING TABLE RULE t_order(STORAGE_UNITS(ds_0,ds_1),SHARDING_COLUMN=order_id,TYPE(NAME="hash_mod",PROPERTIES("sharding-count"="2")),KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME="snowflake")));

# Create logical table
postgres=> CREATE TABLE t_order (
sharding_db=> CREATE TABLE t_order (
order_id INT PRIMARY KEY NOT NULL,
user_id INT NOT NULL,
status CHAR(50)
Expand All @@ -202,12 +202,12 @@ postgres=> CREATE TABLE t_order (
![](./static/shardingsphere-create-sharding-table-rule.png)

8. Insert test data
# Insert
```shell
postgres=> INSERT INTO t_order(order_id, user_id, status) VALUES(1, 1, 'code1'),(2, 2, 'code2'),(3, 3, 'code3'),(4, 4, 'code4');
# Insert
sharding_db=> INSERT INTO t_order(order_id, user_id, status) VALUES(1, 1, 'code1'),(2, 2, 'code2'),(3, 3, 'code3'),(4, 4, 'code4');

# Select
postgres=> SELECT * FROM t_order;
sharding_db=> SELECT * FROM t_order;
```

![](./static/insert-data.png)
Expand Down

0 comments on commit 33fcf38

Please sign in to comment.