ClickHouse/tests/queries/0_stateless/01091_num_threads.sql
Azat Khuzhin 32071ba080 Do not add event_date/event_time condition for system.*_log
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).
2020-05-18 21:18:37 +03:00

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);