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

sql: add command that partitions all indexes of a table in the same way using @* #40383

Closed
awoods187 opened this issue Aug 30, 2019 · 1 comment
Assignees
Labels
A-partitioning A-sql-execution Relating to SQL execution. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@awoods187
Copy link
Contributor

awoods187 commented Aug 30, 2019

Similarly to #40382, we should aim to take advantage of #39357 (via 12a33d7) in which we added support for a new command that will apply zone configs to all indexes on a table with the same partition name. For example:

ALTER PARTITION new_york OF INDEX rides@* CONFIGURE ZONE USING constraints='[+region=us-east,+az=1]';

In the status quo, you must alter the partitions of each index. For example:

ALTER INDEX rides_auto_index_fk_city_ref_users PARTITION BY LIST (city) ( PARTITION new_york VALUES IN ('new york'), PARTITION chicago VALUES IN ('chicago'), PARTITION seattle VALUES IN ('seattle') );

And:

ALTER INDEX rides_auto_index_fk_vehicle_city_ref_vehicles PARTITION BY LIST (vehicle_city) ( PARTITION new_york VALUES IN ('new york'), PARTITION chicago VALUES IN ('chicago'), PARTITION seattle VALUES IN ('seattle') );

It would be great to be able to do this instead:

ALTER INDEX rides@* PARTITION BY LIST (city) ( PARTITION new_york VALUES IN ('new york'), PARTITION chicago VALUES IN ('chicago'), PARTITION seattle VALUES IN ('seattle') );

And then return this:

SHOW PARTITIONS FROM INDEX rides@*;
  database_name | table_name | partition_name | parent_partition | column_names |                     index_name                      | partition_value |                 zone_config
+---------------+------------+----------------+------------------+--------------+-----------------------------------------------------+-----------------+---------------------------------------------+
  movr          | rides      | new_york       | NULL             | city         | rides@rides_auto_index_fk_city_ref_users            | ('new york')    | constraints = '[+region=us-east, +az=1]'
  movr          | rides      | chicago        | NULL             | city         | rides@rides_auto_index_fk_city_ref_users            | ('chicago')     | constraints = '[+region=us-central, +az=1]'
  movr          | rides      | seattle        | NULL             | city         | rides@rides_auto_index_fk_city_ref_users            | ('seattle')     | constraints = '[+region=us-west, +az=2]'
  movr          | rides      | new_york       | NULL             | vehicle_city | rides@rides_auto_index_fk_vehicle_city_ref_vehicles | ('new york')    | constraints = '[+region=us-east, +az=1]'
  movr          | rides      | chicago        | NULL             | vehicle_city | rides@rides_auto_index_fk_vehicle_city_ref_vehicles | ('chicago')     | constraints = '[+region=us-central, +az=1]'
  movr          | rides      | seattle        | NULL             | vehicle_city | rides@rides_auto_index_fk_vehicle_city_ref_vehicles | ('seattle')     | constraints = '[+region=us-west, +az=2]'
@awoods187 awoods187 added A-partitioning C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) labels Aug 30, 2019
@awoods187 awoods187 added the A-sql-execution Relating to SQL execution. label Aug 30, 2019
@solongordon
Copy link
Contributor

Seems superseded by the new multiregion syntax. I'm closing this but it can be re-opened if someone decides this syntax would still be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-partitioning A-sql-execution Relating to SQL execution. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

No branches or pull requests

2 participants