Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/bin/pgcopydb/schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -4199,7 +4199,9 @@ schema_list_partitions(PGSQL *pgsql,
partsCount = splitMaxParts;
}

partsSize = ceil((double) (max - min + 1) / partsCount);
int64_t rangeCount = partsCount > 1 ? partsCount - 1 : 1;

partsSize = ceil((double) (max - min + 1) / rangeCount);
}

/*
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/expected/4-list-table-split.out
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
Part | Min | Max | Count
-------------+--------------+--------------+-------------
1/6 | -1 | -1 | -1
2/6 | 1 | 17 | 17
3/6 | 18 | 34 | 17
4/6 | 35 | 51 | 17
5/6 | 52 | 68 | 17
6/6 | 69 | -1 | -1
2/6 | 1 | 20 | 20
3/6 | 21 | 40 | 20
4/6 | 41 | 60 | 20
5/6 | 61 | 80 | 20
6/6 | 81 | -1 | -1

2024-04-26 15:30:56.753 101 INFO main.c:136 Running pgcopydb version 0.15.59.g9a151a6.dirty from "/usr/local/bin/pgcopydb"
2024-04-26 15:30:56.812 101 INFO copydb.c:105 Using work dir "/tmp/unit/split"
Expand Down Expand Up @@ -60,8 +60,8 @@
Part | Min | Max | Count
-------------+--------------+--------------+-------------
1/3 | -1 | -1 | -1
2/3 | 1 | 34 | 34
3/3 | 35 | -1 | -1
2/3 | 1 | 50 | 50
3/3 | 51 | -1 | -1
20:54:39.774 91 INFO Table public.table_toast_heavy is 6848 kB large which is larger than --split-tables-larger-than 1024 kB, and does not have a unique column of type integer: splitting by CTID
20:54:39.774 91 INFO Table public.table_toast_heavy COPY will be split 2-ways
Part | Min | Max | Count
Expand Down
Loading