forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #276 from Altinity/backports/23.3.3/48299_do_not_b…
…uild_skip_indices_if_not_used 23.3 backport of ClickHouse#48299 Do not build skip indices if not used
- Loading branch information
Showing
4 changed files
with
63 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<test> | ||
<create_query> | ||
CREATE TABLE test_in_skip_idx | ||
( | ||
a UInt64, | ||
s String, | ||
INDEX idx s TYPE bloom_filter GRANULARITY 1 | ||
) | ||
ENGINE = MergeTree() ORDER BY a | ||
</create_query> | ||
|
||
<fill_query>INSERT INTO test_in_skip_idx SELECT number, number FROM numbers(10000000)</fill_query> | ||
<fill_query>OPTIMIZE TABLE test_in_skip_idx FINAL</fill_query> | ||
|
||
<query>SELECT count() FROM test_in_skip_idx WHERE s IN (SELECT toString(number + 10000000) FROM numbers(100000)) SETTINGS use_skip_indexes = 0</query> | ||
<drop_query>DROP TABLE IF EXISTS test_in_skip_idx</drop_query> | ||
</test> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
DROP TABLE IF EXISTS t_skip_index_in; | ||
|
||
CREATE TABLE t_skip_index_in | ||
( | ||
a String, | ||
b String, | ||
c String, | ||
INDEX idx_c c TYPE bloom_filter GRANULARITY 1 | ||
) | ||
ENGINE = MergeTree | ||
ORDER BY (a, b); | ||
|
||
INSERT INTO t_skip_index_in VALUES ('a', 'b', 'c'); | ||
|
||
-- This query checks that set is not being built if indexes are not used, | ||
-- because with EXPLAIN the set will be built only for analysis of indexes. | ||
EXPLAIN SELECT count() FROM t_skip_index_in WHERE c IN (SELECT throwIf(1)) SETTINGS use_skip_indexes = 0 FORMAT Null; | ||
EXPLAIN SELECT count() FROM t_skip_index_in WHERE c IN (SELECT throwIf(1)) SETTINGS use_skip_indexes = 1; -- { serverError FUNCTION_THROW_IF_VALUE_IS_NON_ZERO } | ||
|
||
DROP TABLE t_skip_index_in; |