mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-11 01:54:55 +00:00
32071ba080
Also some of them can be even more simplified, since the system.*_log are empty most of the time there should not be any conditions at all (i.e. `query` LIKE and so on).
48 lines
1.1 KiB
SQL
48 lines
1.1 KiB
SQL
set log_queries=1;
|
|
set log_query_threads=1;
|
|
|
|
SELECT 1;
|
|
SYSTEM FLUSH LOGS;
|
|
|
|
WITH
|
|
(
|
|
SELECT query_id
|
|
FROM system.query_log
|
|
WHERE (query = 'SELECT 1')
|
|
ORDER BY event_time DESC
|
|
LIMIT 1
|
|
) AS id
|
|
SELECT uniqExact(thread_id)
|
|
FROM system.query_thread_log
|
|
WHERE (query_id = id) AND (thread_id != master_thread_id);
|
|
|
|
select sum(number) from numbers(1000000);
|
|
SYSTEM FLUSH LOGS;
|
|
|
|
WITH
|
|
(
|
|
SELECT query_id
|
|
FROM system.query_log
|
|
WHERE (query = 'SELECT sum(number) FROM numbers(1000000)')
|
|
ORDER BY event_time DESC
|
|
LIMIT 1
|
|
) AS id
|
|
SELECT uniqExact(thread_id)
|
|
FROM system.query_thread_log
|
|
WHERE (query_id = id) AND (thread_id != master_thread_id);
|
|
|
|
select sum(number) from numbers_mt(1000000);
|
|
SYSTEM FLUSH LOGS;
|
|
|
|
WITH
|
|
(
|
|
SELECT query_id
|
|
FROM system.query_log
|
|
WHERE (query = 'SELECT sum(number) FROM numbers_mt(1000000)')
|
|
ORDER BY event_time DESC
|
|
LIMIT 1
|
|
) AS id
|
|
SELECT uniqExact(thread_id) > 2
|
|
FROM system.query_thread_log
|
|
WHERE (query_id = id) AND (thread_id != master_thread_id);
|