-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: update error message when zone configs not applied #39477
Comments
You can't even force it onto an index:
Note, this is related to #39357 |
This is actually expected behavior i believe, but it's unclear that this should be the outcome based on the syntax that we have provided. The ALTER PARTITION p OF TABLE t is equivalent to ALTER PARTITION p OF INDEX t@primary.p, meaning that when we say alter partition of table we only really specify anything about the primary index. So to get what you want out of the partitioning you would need to run I think figuring out a good way of saying "apply zone configuration |
I was able to get this to work by running: ALTER PARTITION new_york OF INDEX movr.vehicles@vehicles_auto_index_fk_city_ref_users CONFIGURE ZONE USING constraints='[+region=us-east1]';
ALTER PARTITION chicago OF INDEX movr.vehicles@vehicles_auto_index_fk_city_ref_users CONFIGURE ZONE USING constraints='[+region=us-central1]';
ALTER PARTITION seattle OF INDEX movr.vehicles@vehicles_auto_index_fk_city_ref_users CONFIGURE ZONE USING constraints='[+region=us-west1]'; It looks like this is a change of behavior when looking at movr previously: We partitioned the indexes on rides by running: ALTER INDEX rides_auto_index_fk_city_ref_users PARTITION BY LIST (city) (
PARTITION new_york_idx1 VALUES IN ('new york'),
PARTITION chicago_idx1 VALUES IN ('chicago'),
PARTITION seattle_idx1 VALUES IN ('seattle')
); And then zone configs: ALTER PARTITION new_york_idx1 OF TABLE movr.rides
CONFIGURE ZONE USING constraints='[+region=us-east1]';
ALTER PARTITION chicago_idx1 OF TABLE movr.rides
CONFIGURE ZONE USING constraints='[+region=us-central1]';
ALTER PARTITION seattle_idx1 OF TABLE movr.rides
CONFIGURE ZONE USING constraints='[+region=us-west1]'; We never had to say OF INDEX or specify with the index hint (@). I think we will need to do three things:
|
I'm wondering if we should do something like this -- To adjust an individual partition you must use the ALTER PARTITION p of INDEX t@i syntax. It wasn't clear to me while learning this why there was different syntax to adjust the primary index's partitions vs a secondary index's. |
yeah i like that idea. How would we handle a |
I'm a proponent of each overwriting each other -- I think we should not think about |
Just confirmed that this also works: ALTER PARTITION new_york OF INDEX vehicles@vehicles_auto_index_fk_city_ref_users CONFIGURE ZONE USING constraints='[+region=us-east,+az=1]'; If you do not apply the index hint, you get this message: We should expand upon this to say something like: |
@ericharmeling to make sure you see this for the docs work |
@awoods187 Good catch. I’ll open a docs issue and get it in next week. |
40720: sql: add hint for ALTER PARTITION OF INDEX error r=solongordon a=solongordon If a user accidentally passes a table name (or some other non-existent index name) to ALTER PARTITION ... OF INDEX, they now get a helpful hint suggesting that the use the `<tablename>@<indexname>` syntax to specify the index. Fixes #39477 Release note: None Co-authored-by: Solon Gordon <solon@cockroachlabs.com>
If a user accidentally passes a table name (or some other non-existent index name) to ALTER PARTITION ... OF INDEX, they now get a helpful hint suggesting that the use the <tablename>@<indexname> syntax to specify the index. Fixes cockroachdb#39477 Release note: None
I'm partitioning the Movr table. I've setup the partitions as follows:
This is great because you can now reuse the same partitioning name. However, it causes a new problem when applying zone constraints.
We can show these constraints:
And we can then add them to a table that also has indexes:
Now the show statement:
But this does not apply to all of the indexes! In fact, there is no way to make the zone configs apply to the indexes because previously we did it to something like new_york_idx and that isn't specified anymore.
The text was updated successfully, but these errors were encountered: