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

Delete query triggered a select * #16814

Open
wxiaomou opened this issue Apr 11, 2024 · 0 comments
Open

Delete query triggered a select * #16814

wxiaomou opened this issue Apr 11, 2024 · 0 comments
Labels
type/feature-request Type: Issue - Feature request

Comments

@wxiaomou
Copy link

Feature Request

This issue is that deletes try to select all of the columns in a row prior to deleting instead of just the columns relevant to the index and composite primary key. On tables with large values, this increases the amount of data that gets scanned.

query example:

0 tikv_task:{proc max:2.67s, min:0s, avg: 1.46s, p80:2.52s, p95:2.6s, iters:1141, tasks:25}, scan_detail: {total_process_keys: 1050324, total_process_keys_size: 12500490702, total_keys: 1050351, get_snapshot_time: 9.49ms, rocksdb: {key_skipped_count: 2100624, block: {cache_hit_count: 103039, read_count: 102540, read_byte: 1.39 GB, read_time: 12s}}} N/A N/A
└─Selection_12 cop[tikv] 4000 le(kv.table_name.timestamp, 1704622744942000000), or(gt(kv.table_name.primary_key, "pk_range_start"), or(and(eq(kv.table_name.primary_key, "pk_range_start"), gt(kv.table_name.secondary_key, "sk_range_start")), and(eq(kv.table_name.primary_key, "pk_range_start"), and(eq(kv.table_name.secondary_key, "sk_range_start"), ge(kv.table_name.timestamp, 1707885658544000000))))), or(lt(kv.table_name.primary_key, "pk_range_end"), or(and(eq(kv.table_name.primary_key, "pk_range_end"), lt(kv.table_name.secondary_key, "sk_range_end")), and(eq(kv.table_name.primary_key, "pk_range_end"), and(eq(kv.table_name.secondary_key, "sk_range_end"), le(kv.table_name.timestamp, 1707885658544000000))))) 0 tikv_task:{proc max:2.67s, min:0s, avg: 1.46s, p80:2.52s, p95:2.6s, iters:1141, tasks:25} N/A N/A
└─TableRangeScan_11 cop[tikv] 5000 table:table_name, range:[pk_range_start,pk_range_start], (pk_range_start,pk_range_end), [pk_range_end,pk_range_end], keep order:false, stats:pseudo 1050324 tikv_task:{proc max:2.66s, min:0s, avg: 1.45s, p80:2.52s, p95:2.59s, iters:1141, tasks:25} N/A N/A
Plan_digest: bcdc4a42f09720ccdcb027978269914644191d4f802439990219556183bced9d
Binary_plan:...
Prev_stmt:
Query: delete from table_name where ( primary_key > ? or ( primary_key = ? and secondary_key > ? ) or ( primary_key = ? and secondary_key = ? and timestamp >= ? ) ) and ( primary_key < ? or ( primary_key = ? and secondary_key < ? ) or ( primary_key = ? and secondary_key = ? and timestamp <= ? ) ) and timestamp <= ? - ? limit ? ;
1 row in set (2.52 sec)

Is your feature request related to a problem? Please describe:

Describe the feature you'd like:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

@wxiaomou wxiaomou added the type/feature-request Type: Issue - Feature request label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request Type: Issue - Feature request
Projects
None yet
Development

No branches or pull requests

1 participant