Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YSQL] Support for specifying split points for range-based partitioning #1486

Closed
m-iancu opened this issue Jun 5, 2019 · 0 comments
Closed
Assignees
Labels
area/ysql Yugabyte SQL (YSQL)

Comments

@m-iancu
Copy link
Contributor

m-iancu commented Jun 5, 2019

After #1134, we can create range-partitioned tables (instead of hash-partitioned).
For instance, by explicitly setting the ASC column order for the first column:

CREATE TABLE test(a int, b int, c int, PRIMARY KEY (a ASC, b, c));
CREATE UNIQUE INDEX test_idx ON test (b ASC, c);

In that case, it can be useful for users to explicitly set split-points to pre-split such tables.
For instance, we could add an additional (optional) clause to create table/index statements along the lines of:

SPLIT ( INTO num_tablets TABLETS | AT VALUES '(' ... ')',  ... )
@kmuthukk kmuthukk added the area/ysql Yugabyte SQL (YSQL) label Jun 5, 2019
@ndeodhar ndeodhar assigned georgeklees and unassigned georgeklees and ndeodhar Aug 5, 2019
georgeklees added a commit that referenced this issue Aug 16, 2019
…um_tablets splitting

Summary:
Extend the Postgres grammar for `CREATE TABLE` to allow specifying tablet split options:
either a number of tablets or (for range partitioning) split points in the key domain. In this diff,
split points are parsed but not implemented on the YugaByte side. The number of tablets specifier
is passed on to the YugaByte side, so that feature works.

Test Plan:
* Perform a `CREATE TABLE ... SPLIT (INTO num_tablets TABLETS)` command, and ensure afterwards that it succeeds and generates the specified number of tablets in the YugaByte data directory.
* Validate that `TestPgRegressPgMisc` (which has been updated to test the `SPLIT` statement parsing) passes

Reviewers: mihnea, neha

Reviewed By: neha

Subscribers: yql

Differential Revision: https://phabricator.dev.yugabyte.com/D7064
@ndeodhar ndeodhar assigned ndeodhar and d-uspenskiy and unassigned georgeklees Aug 24, 2019
@ndeodhar ndeodhar assigned ndeodhar and unassigned Zhongweizhao Jan 17, 2020
ndeodhar added a commit that referenced this issue Apr 26, 2020
…ble creation

Summary:
This diff adds support to pre-split range tables using `SPLIT AT VALUES` clause in `CREATE TABLE`.

What's included:
1. SPLIT AT clause in CREATE TABLE. This is guarded by beta flag.
2. Push down of equality, range conditions for full as well as partially set PK.
3. Partition uses dockey encoding for range tables.

What's pending:
1. IN clause push down. Current version will scan all tablets for IN clause.
2. SPLIT AT clause in CREATE INDEX statement.

Example usage:
```
CREATE TABLE tbl(
  a int,
  b int,
  primary key(a asc, b desc)
) SPLIT AT VALUES((100), (200), (200, 5));
```

Test Plan:
Jenkins
Added libpq and Java tests

Reviewers: jason, mikhail, mihnea

Reviewed By: mihnea

Subscribers: yql, sudheer, bogdan

Differential Revision: https://phabricator.dev.yugabyte.com/D8283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL)
Projects
None yet
Development

No branches or pull requests

6 participants