Skip to content

generate_series creates records for each shard instead of splitting records into shards. #1096

Description

@hanjianqiao

PgDog version
ghcr.io/pgdogdev/pgdog:latest

Description
When inserting 200 data entries using the generate_series function, 200 data entries were generated for each shard, which was intended to distribute these 200 data entries evenly across the shards.

Logs

# using pgdog with two shards
CREATE TABLE orders (order_id bigint, customer_id bigint, amount numeric(10,2), PRIMARY KEY (order_id, customer_id));
INSERT INTO orders SELECT g, g, (g*1.5) FROM generate_series(1,200) g;

After previous query is done, via pgdog select count(*) from orders; returns 400, and each shard has 200 same records.

Configuration
pgdog.shard.toml

[general]
host = "0.0.0.0"
port = 6432
default_pool_size = 10

[[databases]]
name = "data_shard"
host = "data-shard0"
port = 5432
database_name = "testdb"
shard = 0

[[databases]]
name = "data_shard"
host = "data-shard1"
port = 5432
database_name = "testdb"
shard = 1

[[sharded_tables]]
database = "data_shard"
column = "customer_id"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions