Repository navigation
Conversation
|
@rschu1ze Hi |
|
@pheepa I am on a business trip right now but I'll check once I am back, thanks! |
There was a problem hiding this comment.
Does field projection in system.query_log also include the database name (default)?
There was a problem hiding this comment.
It is not clear what this enum is good for. Column, partition and skip_index seem unrelated concepts.
There was a problem hiding this comment.
I wanted to encapsulate the logic for setting different fields of QueryAccessInfo
Since these attributes have same type, we cant override twice addQueryAccessInfo(String &, String &)
But I would appreciate if you share better solution
skip_indexes to system.query_log
|
Dear @rschu1ze, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
We appreciate the contribution, but due to our mistake, this got abandoned and then I implemented it in another pull request: #87862. |
|
Hey @grantholly-clickhouse, thank you for noticing! |
|
Let's start with bringing in the upstream master branch and fixing conflicts. After that, I want to bring over the query test that I was using in my branch and see if it works here. |
|
@pheepa could you bring in the latest changes and fix conflicts? |
|
Dear @grantholly-clickhouse, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Keep the `addQueryAccessInfo` overloads that master added and uses (`StorageID`, columns, `removeQueryAccessInfoTable`); `buildPushingToViewsChain.cpp` and the old `docs/en` page were removed in master (the code moved to `InsertDependenciesBuilder`, the docs are autogenerated now). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [be0a7c4] Summary: ❌
AI ReviewSummaryAdds PR Metadata
Findings❌ Blockers
💡 Nits
Tests
Missing context / blind spots
Final Verdict❌ Block. Preserve existing partition formatting, collect actual index usage across analysis and runtime execution, and cover the demonstrated failures. Restore the changelog heading. |
| } | ||
| context->getQueryContext()->addQueryAccessInfo(partition_names); | ||
| context->getQueryContext()->addQueryAccessInfo( | ||
| data.getStorageID().getFullTableName(), Context::TableAccessInfoType::PARTITION, partition_names); |
There was a problem hiding this comment.
[Blocker] Preserve the existing partitions representation when adding skip_indexes.
This now passes partition IDs through backQuoteIfNeed, changing an ordinary numeric partition from db.partitioned.3 to db.partitioned.`3` . Database and table names can acquire quoting too. I reproduced this with PARTITION BY a and a = 3: extracting the third dot-separated component and applying toUInt64OrNull now returns NULL. Existing queries that parse partition IDs or match them against system.parts.partition_id therefore break. The changed reference for 02751_query_log_test_partitions also demonstrates the compatibility change.
Keep the previous partition formatting and apply the new quoting helper only to columns and indexes. If changing the existing format is intentional, it needs an explicit compatibility path and migration documentation.
| for (const auto & index_stat : result.index_stats) | ||
| { | ||
| if (index_stat.type == IndexType::Skip) | ||
| skip_index_names.emplace_back(index_stat.name); |
There was a problem hiding this comment.
[Major] index_stats contains diagnostic entries that are not indexes actually used by the query.
filterPartsByPrimaryKeyAndSkipIndexes emits a Skip statistic for each useful index even when its file is absent. On the PR's CI binary, creating a part, adding a minmax index with ALTER TABLE ... ADD INDEX without materializing it, then filtering its column with use_skip_indexes_on_data_read = 0 logs that index here, while the server explicitly reports that the file does not exist and skips it.
The same loop also copies the synthetic <Combined skip indexes> statistic: an a < 16 OR b = 42 query over two indexed columns logs db.disjunction.`<Combined skip indexes>` alongside the real names. That index does not exist.
Track concrete index usage rather than treating the EXPLAIN statistics list as a usage set, and add coverage for both an unmaterialized index and disjunction processing.
| context->getQueryContext()->addQueryAccessInfo( | ||
| data.getStorageID().getFullTableName(), Context::TableAccessInfoType::SKIP_INDEX, skip_index_names); |
There was a problem hiding this comment.
[Major] Record indexes applied during execution as well as those represented in the initial analysis.
This is the only producer of skip_indexes, but runtime_skip_indexes is selected later in this method and consumed by MergeTreeSkipIndexReader::read without updating QueryAccessInfo. A join whose probe key has no constant predicate therefore omits an index that it actually uses.
I reproduced this on the PR's CI binary with fact(id, k, v, INDEX idx_k k TYPE bloom_filter GRANULARITY 1) ORDER BY id, 2,000 rows, and a join on k to a dimension filtered to 64 keys. With enable_join_runtime_filters_index_analysis = 1 and use_skip_indexes_on_data_read = 1, QueryFinish.skip_indexes is [], although RuntimeFilterGranulesDropped is 25 and the server confirms pruning through the skip index (primary_key=false, skip_index=true).
Record usage where the runtime index is evaluated, merge it into the final query log entry, and add a stateless join regression case. Initial analysis statistics alone cannot cover this path.
Resolves #78676
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to
Added a field
skip_indexesto system tablequery_logwhich shows which skip indexes were used during query execution.Documentation entry for user-facing changes
Workflow [PR]
Sync PR [sync-upstream/pr/79635]