mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 01:41:59 +00:00
43 lines
887 B
MySQL
43 lines
887 B
MySQL
|
DROP TABLE IF EXISTS m;
|
||
|
DROP TABLE IF EXISTS t1;
|
||
|
DROP TABLE IF EXISTS t2;
|
||
|
|
||
|
CREATE TABLE m
|
||
|
(
|
||
|
`a` String,
|
||
|
`f` UInt8
|
||
|
)
|
||
|
ENGINE = Merge(currentDatabase(), '^(t1|t2)$');
|
||
|
|
||
|
CREATE TABLE t1
|
||
|
(
|
||
|
a String,
|
||
|
f UInt8 ALIAS 0
|
||
|
)
|
||
|
ENGINE = MergeTree
|
||
|
ORDER BY tuple()
|
||
|
SETTINGS index_granularity = 8192;
|
||
|
INSERT INTO t1 VALUES ('OK');
|
||
|
|
||
|
-- { echoOn }
|
||
|
-- for pure PREWHERE it is not addressed yet.
|
||
|
SELECT * FROM m PREWHERE a = 'OK';
|
||
|
SELECT * FROM m PREWHERE f = 0; -- { serverError ILLEGAL_PREWHERE }
|
||
|
SELECT * FROM m WHERE f = 0 SETTINGS optimize_move_to_prewhere=0;
|
||
|
SELECT * FROM m WHERE f = 0 SETTINGS optimize_move_to_prewhere=1;
|
||
|
-- { echoOff }
|
||
|
|
||
|
CREATE TABLE t2
|
||
|
(
|
||
|
a String,
|
||
|
f UInt8,
|
||
|
)
|
||
|
ENGINE = MergeTree
|
||
|
ORDER BY tuple()
|
||
|
SETTINGS index_granularity = 8192;
|
||
|
INSERT INTO t2 VALUES ('OK', 1);
|
||
|
|
||
|
-- { echoOn }
|
||
|
SELECT * FROM m WHERE f = 0 SETTINGS optimize_move_to_prewhere=1;
|
||
|
-- { echoOff }
|