mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
add setting
This commit is contained in:
parent
fa5010ba18
commit
77298ef479
@ -2863,6 +2863,9 @@ Possible values:
|
|||||||
**See Also**
|
**See Also**
|
||||||
|
|
||||||
- [ORDER BY Clause](../../sql-reference/statements/select/order-by.md/#optimize_read_in_order)
|
- [ORDER BY Clause](../../sql-reference/statements/select/order-by.md/#optimize_read_in_order)
|
||||||
|
)", 0) \
|
||||||
|
DECLARE(Bool, read_in_order_use_virtual_row, false, R"(
|
||||||
|
Use virtual row while reading in order of primary key or its monotonic function fashion. It is useful when searching over multiple parts as only relevant ones are touched.
|
||||||
)", 0) \
|
)", 0) \
|
||||||
DECLARE(Bool, optimize_read_in_window_order, true, R"(
|
DECLARE(Bool, optimize_read_in_window_order, true, R"(
|
||||||
Enable ORDER BY optimization in window clause for reading data in corresponding order in MergeTree tables.
|
Enable ORDER BY optimization in window clause for reading data in corresponding order in MergeTree tables.
|
||||||
|
@ -64,6 +64,7 @@ static std::initializer_list<std::pair<ClickHouseVersion, SettingsChangesHistory
|
|||||||
},
|
},
|
||||||
{"24.11",
|
{"24.11",
|
||||||
{
|
{
|
||||||
|
{"read_in_order_use_virtual_row", false, false, "Use virtual row while reading in order of primary key or its monotonic function fashion. It is useful when searching over multiple parts as only relevant ones are touched."},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{"24.10",
|
{"24.10",
|
||||||
|
@ -177,6 +177,7 @@ namespace Setting
|
|||||||
extern const SettingsBool use_skip_indexes_if_final;
|
extern const SettingsBool use_skip_indexes_if_final;
|
||||||
extern const SettingsBool use_uncompressed_cache;
|
extern const SettingsBool use_uncompressed_cache;
|
||||||
extern const SettingsUInt64 merge_tree_min_read_task_size;
|
extern const SettingsUInt64 merge_tree_min_read_task_size;
|
||||||
|
extern const SettingsBool read_in_order_use_virtual_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MergeTreeSetting
|
namespace MergeTreeSetting
|
||||||
@ -1852,7 +1853,7 @@ bool ReadFromMergeTree::requestReadingInOrder(size_t prefix_size, int direction,
|
|||||||
enable_vertical_final = false;
|
enable_vertical_final = false;
|
||||||
|
|
||||||
/// Disable virtual row for FINAL.
|
/// Disable virtual row for FINAL.
|
||||||
if (virtual_row_conversion_ && !isQueryWithFinal())
|
if (virtual_row_conversion_ && !isQueryWithFinal() && context->getSettingsRef()[Setting::read_in_order_use_virtual_row])
|
||||||
virtual_row_conversion = std::make_shared<ExpressionActions>(std::move(*virtual_row_conversion_));
|
virtual_row_conversion = std::make_shared<ExpressionActions>(std::move(*virtual_row_conversion_));
|
||||||
|
|
||||||
updateSortDescription();
|
updateSortDescription();
|
||||||
|
@ -7,7 +7,7 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|||||||
|
|
||||||
for i in $(seq 0 1)
|
for i in $(seq 0 1)
|
||||||
do
|
do
|
||||||
CH_CLIENT="$CLICKHOUSE_CLIENT --optimize_move_to_prewhere=1 --convert_query_to_cnf=0 --optimize_read_in_order=1 --enable_analyzer=$i"
|
CH_CLIENT="$CLICKHOUSE_CLIENT --optimize_move_to_prewhere=1 --convert_query_to_cnf=0 --optimize_read_in_order=1 --read_in_order_use_virtual_row=1 --enable_analyzer=$i"
|
||||||
|
|
||||||
$CH_CLIENT -q "drop table if exists test_index"
|
$CH_CLIENT -q "drop table if exists test_index"
|
||||||
$CH_CLIENT -q "drop table if exists idx"
|
$CH_CLIENT -q "drop table if exists idx"
|
||||||
|
@ -2,6 +2,7 @@ SET max_threads=0;
|
|||||||
SET optimize_read_in_order=1;
|
SET optimize_read_in_order=1;
|
||||||
SET optimize_trivial_insert_select = 1;
|
SET optimize_trivial_insert_select = 1;
|
||||||
SET read_in_order_two_level_merge_threshold=100;
|
SET read_in_order_two_level_merge_threshold=100;
|
||||||
|
SET read_in_order_use_virtual_row = 1;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t_read_in_order;
|
DROP TABLE IF EXISTS t_read_in_order;
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
SET read_in_order_use_virtual_row = 1;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t;
|
DROP TABLE IF EXISTS t;
|
||||||
|
|
||||||
CREATE TABLE t
|
CREATE TABLE t
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-- Tags: no-random-merge-tree-settings, no-object-storage
|
-- Tags: no-random-merge-tree-settings, no-object-storage
|
||||||
|
|
||||||
SET optimize_read_in_order = 1, merge_tree_min_rows_for_concurrent_read = 1000;
|
SET optimize_read_in_order = 1, merge_tree_min_rows_for_concurrent_read = 1000, read_in_order_use_virtual_row = 1;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS tab;
|
DROP TABLE IF EXISTS tab;
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ CREATE DATABASE test_03031;
|
|||||||
|
|
||||||
USE test_03031;
|
USE test_03031;
|
||||||
|
|
||||||
|
SET read_in_order_use_virtual_row = 1;
|
||||||
|
|
||||||
CREATE TABLE src (s String) ENGINE = MergeTree() ORDER BY s;
|
CREATE TABLE src (s String) ENGINE = MergeTree() ORDER BY s;
|
||||||
INSERT INTO src(s) VALUES ('before moving tables');
|
INSERT INTO src(s) VALUES ('before moving tables');
|
||||||
CREATE TABLE dist (s String) ENGINE = Distributed(test_shard_localhost, test_03031, src);
|
CREATE TABLE dist (s String) ENGINE = Distributed(test_shard_localhost, test_03031, src);
|
||||||
|
Loading…
Reference in New Issue
Block a user