-
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
ttl: improve row deletion performance with secondary indexes #82140
Comments
cc @rmloveland it may be worth documenting on the TTL docs that tables with multiple indexes may benefit from a lower |
Thanks Oliver, added this info as a comment on cockroachdb/docs#13703 to make sure it's captured with some other issues @vy-ton wrote up! |
#79134 is starting to ask the question of what needs to change during SQL planning and execution if referential integrity is not enforced. It turns out, not much. There are a few SQL optimizations that need to be disabled, mostly related to limit pushdown across table and index joins. We also needed to disable SKIP LOCKED on tables with column families, but that might not be relevant here if we can enforce per-range consistency (a row's column families will never span ranges). Those findings may be relevant here because it means that we don't need to push filtering of expired rows all the way down to individual index scans (which in turn requires all secondary indexes to store the expiration). Instead, we can lift this filtering higher up in the query plan. Or forgoe it entirely if we're ok with not promising that two separate queries that touch different indexes see consistent results. |
118308: roachtest: fix lease_preferences configure zone r=shralex a=kvoli e2a5b35 updated the `lease_prefernces` roachtest to use `configureZone` but incorrectly specified just "kv" as the zone target. Update the zone target to correctly include the database qualifier. Fixes: #118304 Informs: #117311 Release note: None 118318: ttljob: add hint to use PK in delete query r=rafiss a=rafiss This will help avoid choosing a plan that scans a secondary index, which can lead to many KV rows being scanned and also lead to contention. informs #82140 Release note (bug fix): Fixed a bug that could cause DELETE queries sent by the row-level TTL job to use a secondary index rather than the primary index to find the rows to delete. This could lead to some DELETE operations taking a much longer time than they should. This bug was present since v22.2.0. Co-authored-by: Austen McClernon <austen@cockroachlabs.com> Co-authored-by: Rafi Shamim <rafi@cockroachlabs.com>
Currently, a row-level TTL table with secondary indexes may be slower to delete, as it requires access to multiple ranges to perform the deletion.
We can improve this based on this section of the RFC:
Jira issue: CRDB-16224
The text was updated successfully, but these errors were encountered: