mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 21:24:28 +00:00
22 lines
1.2 KiB
SQL
22 lines
1.2 KiB
SQL
DROP TABLE IF EXISTS tmp;
|
|
|
|
CREATE TABLE tmp ENGINE = TinyLog AS SELECT queryID();
|
|
SYSTEM FLUSH LOGS;
|
|
SELECT query FROM system.query_log WHERE query_id = (SELECT * FROM tmp) AND current_database = currentDatabase() LIMIT 1;
|
|
DROP TABLE tmp;
|
|
|
|
CREATE TABLE tmp ENGINE = TinyLog AS SELECT initialQueryID();
|
|
SYSTEM FLUSH LOGS;
|
|
SELECT query FROM system.query_log WHERE initial_query_id = (SELECT * FROM tmp) AND current_database = currentDatabase() LIMIT 1;
|
|
DROP TABLE tmp;
|
|
|
|
CREATE TABLE tmp (str String) ENGINE = Log;
|
|
INSERT INTO tmp (*) VALUES ('a')
|
|
SELECT count() FROM (SELECT initialQueryID() FROM remote('127.0.0.{1..3}', currentDatabase(), 'tmp') GROUP BY queryID());
|
|
SELECT count() FROM (SELECT queryID() FROM remote('127.0.0.{1..3}', currentDatabase(), 'tmp') GROUP BY queryID());
|
|
SELECT count() FROM (SELECT queryID() AS t FROM remote('127.0.0.{1..3}', currentDatabase(), 'tmp') GROUP BY queryID() HAVING t == initialQueryID());
|
|
SELECT count(DISTINCT t) FROM (SELECT initialQueryID() AS t FROM remote('127.0.0.{1..3}', currentDatabase(), 'tmp') GROUP BY queryID());
|
|
SELECT count(DISTINCT t) FROM (SELECT queryID() AS t FROM remote('127.0.0.{1..3}', currentDatabase(), 'tmp') GROUP BY queryID());
|
|
DROP TABLE tmp;
|
|
|