Add verbose description for pre-LIMIT into EXPLAIN query

This commit is contained in:
Azat Khuzhin 2021-08-05 21:05:46 +03:00
parent e36bc3bbaf
commit c4e2342a06
3 changed files with 10 additions and 7 deletions

View File

@ -2429,7 +2429,10 @@ void InterpreterSelectQuery::executePreLimit(QueryPlan & query_plan, bool do_not
} }
auto limit = std::make_unique<LimitStep>(query_plan.getCurrentDataStream(), limit_length, limit_offset); auto limit = std::make_unique<LimitStep>(query_plan.getCurrentDataStream(), limit_length, limit_offset);
limit->setStepDescription("preliminary LIMIT"); if (do_not_skip_offset)
limit->setStepDescription("preliminary LIMIT (with OFFSET)");
else
limit->setStepDescription("preliminary LIMIT (without OFFSET)");
query_plan.addStep(std::move(limit)); query_plan.addStep(std::move(limit));
} }
} }

View File

@ -5,7 +5,7 @@ FROM test_order_by
ORDER BY timestamp ASC ORDER BY timestamp ASC
LIMIT 10 LIMIT 10
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT) Limit (preliminary LIMIT (without OFFSET))
MergingSorted (Merge sorted streams for ORDER BY) MergingSorted (Merge sorted streams for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY) MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY) PartialSorting (Sort each block for ORDER BY)
@ -19,7 +19,7 @@ FROM test_order_by
ORDER BY toDate(timestamp) ASC ORDER BY toDate(timestamp) ASC
LIMIT 10 LIMIT 10
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT) Limit (preliminary LIMIT (without OFFSET))
FinishSorting FinishSorting
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
@ -33,7 +33,7 @@ ORDER BY
timestamp ASC timestamp ASC
LIMIT 10 LIMIT 10
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT) Limit (preliminary LIMIT (without OFFSET))
FinishSorting FinishSorting
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)

View File

@ -22,7 +22,7 @@ lambda
1 1
optimize_read_in_order optimize_read_in_order
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT) Limit (preliminary LIMIT (without OFFSET))
MergingSorted (Merge sorted streams for ORDER BY) MergingSorted (Merge sorted streams for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY) MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY) PartialSorting (Sort each block for ORDER BY)
@ -30,13 +30,13 @@ Expression (Projection)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromMergeTree ReadFromMergeTree
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT) Limit (preliminary LIMIT (without OFFSET))
FinishSorting FinishSorting
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromMergeTree ReadFromMergeTree
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT) Limit (preliminary LIMIT (without OFFSET))
FinishSorting FinishSorting
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)