upd setSkipIndexes

This commit is contained in:
Nikita Vasilev 2019-01-16 21:35:03 +03:00
parent 08d23c16d1
commit 579832ff9b
3 changed files with 40 additions and 7 deletions

View File

@ -353,6 +353,11 @@ void MergeTreeData::setSkipIndexes(const ASTPtr & indexes_asts, bool only_check)
{
if (!indexes_asts)
{
if (!only_check)
{
skip_indexes_ast = indexes_asts;
indexes.clear();
}
return;
}

View File

@ -0,0 +1,28 @@
CREATE TABLE test.minmax_idx ( u64 UInt64, i32 Int32) ENGINE = MergeTree() ORDER BY u64 INDEXES idx1 BY u64 * i32 TYPE minmax GRANULARITY 10, idx3 BY u64 - i32 TYPE minmax GRANULARITY 10, idx2 BY u64 + i32 TYPE minmax GRANULARITY 10 SETTINGS index_granularity = 8192
1 2
1 2
1 2
1 2
1 2
1 2
1 2
CREATE TABLE test.minmax_idx ( u64 UInt64, i32 Int32) ENGINE = MergeTree() ORDER BY u64 INDEXES idx3 BY u64 - i32 TYPE minmax GRANULARITY 10, idx2 BY u64 + i32 TYPE minmax GRANULARITY 10 SETTINGS index_granularity = 8192
1 2
1 2
1 2
1 2
1 2
1 2
CREATE TABLE test.minmax_idx ( u64 UInt64, i32 Int32) ENGINE = MergeTree() ORDER BY u64 INDEXES idx2 BY u64 + i32 TYPE minmax GRANULARITY 10 SETTINGS index_granularity = 8192
CREATE TABLE test.minmax_idx ( u64 UInt64, i32 Int32) ENGINE = MergeTree() ORDER BY u64 INDEXES idx1 BY u64 * i32 TYPE minmax GRANULARITY 10 SETTINGS index_granularity = 8192
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
CREATE TABLE test.minmax_idx2 ( u64 UInt64, i32 Int32) ENGINE = MergeTree() ORDER BY u64 INDEXES idx1 BY u64 + i32 TYPE minmax GRANULARITY 10, idx2 BY u64 * i32 TYPE minmax GRANULARITY 10 SETTINGS index_granularity = 8192
1 2
1 2

View File

@ -16,7 +16,7 @@ ALTER TABLE test.minmax_idx ADD INDEX idx3 BY u64 - i32 TYPE minmax GRANULARITY
SHOW CREATE TABLE test.minmax_idx;
SELECT * FROM test.minmax_idx WHERE u64 * i32 = 3;
SELECT * FROM test.minmax_idx WHERE u64 * i32 = 2;
INSERT INTO test.minmax_idx VALUES (1, 2);
INSERT INTO test.minmax_idx VALUES (1, 2);
@ -24,16 +24,16 @@ INSERT INTO test.minmax_idx VALUES (1, 2);
INSERT INTO test.minmax_idx VALUES (1, 2);
INSERT INTO test.minmax_idx VALUES (1, 2);
SELECT * FROM test.minmax_idx WHERE u64 * i32 = 3;
SELECT * FROM test.minmax_idx WHERE u64 * i32 = 2;
ALTER TABLE test.minmax_idx DROP INDEX idx1;
SHOW CREATE TABLE test.minmax_idx;
SELECT * FROM test.minmax_idx WHERE u64 * i32 = 3;
SELECT * FROM test.minmax_idx WHERE u64 * i32 = 2;
ALTER TABLE test.minmax_idx DROP INDEX idx3;
ALTER TABLE test.minmax_idx DROP INDEX idx2;
ALTER TABLE test.minmax_idx DROP INDEX idx3;
SHOW CREATE TABLE test.minmax_idx;
@ -41,7 +41,7 @@ ALTER TABLE test.minmax_idx ADD INDEX idx1 BY u64 * i32 TYPE minmax GRANULARITY
SHOW CREATE TABLE test.minmax_idx;
SELECT * FROM test.minmax_idx WHERE u64 * i32 = 3;
SELECT * FROM test.minmax_idx WHERE u64 * i32 = 2;
CREATE TABLE test.minmax_idx2
@ -56,13 +56,13 @@ INDEXES idx1 BY u64 + i32 TYPE minmax GRANULARITY 10,
INSERT INTO test.minmax_idx2 VALUES (1, 2);
INSERT INTO test.minmax_idx2 VALUES (1, 2);
SELECT * FROM test.minmax_idx2 WHERE u64 * i32 = 3;
SELECT * FROM test.minmax_idx2 WHERE u64 * i32 = 2;
ALTER TABLE test.minmax_idx2 DROP INDEX idx1, DROP INDEX idx2;
SHOW CREATE TABLE test.minmax_idx2;
SELECT * FROM test.minmax_idx2 WHERE u64 * i32 = 3;
SELECT * FROM test.minmax_idx2 WHERE u64 * i32 = 2;
DROP TABLE test.minmax_idx;
DROP TABLE test.minmax_idx2;