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

feat(pruning): add pruning stats to EXPLAIN #9724

Merged
merged 4 commits into from
Jan 25, 2023

Conversation

BohuTANG
Copy link
Member

@BohuTANG BohuTANG commented Jan 25, 2023

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Only works in standalone:

mysql> explain SELECT URLHash, EventDate, COUNT(*) AS PageViews FROM hits WHERE CounterID = 62 AND EventDate >= '2013-07-01' AND EventDate <= '2013-07-31' AND IsRefresh = 0 AND TraficSourceID IN (-1, 6) AND RefererHash = 3594120000172545465 GROUP BY URLHash, EventDate ORDER BY PageViews DESC LIMIT 10 OFFSET 100;
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| explain                                                                                                                                                                                                                                                                                                                                                                                      |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Limit                                                                                                                                                                                                                                                                                                                                                                                        |
| ├── limit: 10                                                                                                                                                                                                                                                                                                                                                                                |
| ├── offset: 100                                                                                                                                                                                                                                                                                                                                                                              |
| ├── estimated rows: 0.00                                                                                                                                                                                                                                                                                                                                                                     |
| └── Sort                                                                                                                                                                                                                                                                                                                                                                                     |
|     ├── sort keys: [pageviews DESC NULLS LAST]                                                                                                                                                                                                                                                                                                                                               |
|     ├── estimated rows: 0.00                                                                                                                                                                                                                                                                                                                                                                 |
|     └── EvalScalar                                                                                                                                                                                                                                                                                                                                                                           |
|         ├── expressions: [COUNT(*) (#107)]                                                                                                                                                                                                                                                                                                                                                   |
|         ├── estimated rows: 0.00                                                                                                                                                                                                                                                                                                                                                             |
|         └── AggregateFinal                                                                                                                                                                                                                                                                                                                                                                   |
|             ├── group by: [urlhash, eventdate]                                                                                                                                                                                                                                                                                                                                               |
|             ├── aggregate functions: [count()]                                                                                                                                                                                                                                                                                                                                               |
|             ├── estimated rows: 0.00                                                                                                                                                                                                                                                                                                                                                         |
|             └── AggregatePartial                                                                                                                                                                                                                                                                                                                                                             |
|                 ├── group by: [urlhash, eventdate]                                                                                                                                                                                                                                                                                                                                           |
|                 ├── aggregate functions: [count()]                                                                                                                                                                                                                                                                                                                                           |
|                 ├── estimated rows: 0.00                                                                                                                                                                                                                                                                                                                                                     |
|                 └── Filter                                                                                                                                                                                                                                                                                                                                                                   |
|                     ├── filters: [eq(hits.counterid (#6), to_int32(62_u8)), gte(hits.eventdate (#5), to_date("2013-07-01")), lte(hits.eventdate (#5), to_date("2013-07-31")), eq(hits.isrefresh (#15), to_int16(0_u8)), or(eq(hits.traficsourceid (#37), minus(1_u8)), eq(hits.traficsourceid (#37), to_int16(6_u8))), eq(hits.refererhash (#102), to_int64(3594120000172545465_u64))]       |
|                     ├── estimated rows: 0.00                                                                                                                                                                                                                                                                                                                                                 |
|                     └── TableScan                                                                                                                                                                                                                                                                                                                                                            |
|                         ├── table: default.hits.hits                                                                                                                                                                                                                                                                                                                                         |
|                         ├── read rows: 6574090                                                                                                                                                                                                                                                                                                                                               |
|                         ├── read bytes: 75603278                                                                                                                                                                                                                                                                                                                                             |
|                         ├── partitions total: 751                                                                                                                                                                                                                                                                                                                                            |
|                         ├── partitions scanned: 51                                                                                                                                                                                                                                                                                                                                           |
|                         ├── pruning stats: [segments: <range pruning: 32 to 25>, blocks: <range pruning: 589 to 51, bloom pruning: 51 to 51>]                                                                                                                                                                                                                                                |
|                         ├── push downs: [filters: [eq(hits.counterid (#6), 62_i32), gte(hits.eventdate (#5), 2013-07-01), lte(hits.eventdate (#5), 2013-07-31), eq(hits.isrefresh (#15), 0_i16), or(eq(hits.traficsourceid (#37), -1_i16), eq(hits.traficsourceid (#37), 6_i16)), eq(hits.refererhash (#102), 3594120000172545465_i64)], limit: NONE]                                        |
|                         ├── output columns: [5, 6, 15, 37, 102, 103]                                                                                                                                                                                                                                                                                                                         |
|                         └── estimated rows: 99997497.00                                                                                                                                                                                                                                                                                                                                      |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Closes #9723

@vercel
Copy link

vercel bot commented Jan 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
databend ⬜️ Ignored (Inspect) Jan 25, 2023 at 3:12PM (UTC)

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Jan 25, 2023
@BohuTANG BohuTANG changed the title feat(pruning): add pruning stats to PartStatistics feat(pruning): add pruning stats to EXPLAIN Jan 25, 2023
@BohuTANG BohuTANG requested review from leiysky and zhang2014 January 25, 2023 15:32
@BohuTANG BohuTANG marked this pull request as ready for review January 25, 2023 15:32
@BohuTANG BohuTANG merged commit 3698a4f into databendlabs:main Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add pruning to explain output
1 participant