Open cmanallen opened 1 year ago
Adding additional information on how the distinct clause matches up against a group by clause and a regular row scan.
┌─query_duration_ms─┬─read_rows─┬─read_bytes─┬─result_rows─┬─memory_usage─┬─query────────────────────────────────────────────────────────────┐
│ 29 │ 1000000 │ 16000000 │ 1 │ 14575690 │ select replay_id from replays_test group by replay_id limit 1 │
│ 17 │ 344064 │ 5505024 │ 1 │ 0 │ select distinct replay_id from replays_test limit 1 │
│ 6 │ 1 │ 16 │ 1 │ 0 │ select replay_id from replays_test limit 1 │
└───────────────────┴───────────┴────────────┴─────────────┴──────────────┴──────────────────────────────────────────────────────────────────┘
Example queries:
Why it matters:
Real world data for a query which is guaranteed to match every row in the set: