If a Clickhouse query is running slow, how would you troubleshoot the issue?
For this PostgreSQL exercise, translate the diagnostic step into a query over the supplied query log tables. Analyze executions from 2026-08-19 onward, retain executions lasting at least 1,000 milliseconds, and report repeated slow query patterns.
user_name, query_pattern, execution_count, average_duration_ms, maximum_duration_ms, maximum_rows_scanned| Column | Type | Description |
|---|---|---|
| query_log_idPK | INT | Unique query execution log identifier |
| user_id | INT | Identifier of the user who ran the query |
| query_text | TEXT | SQL text recorded for the execution |
| duration_ms | INT | Execution duration in milliseconds |
| rows_scanned | INT | Number of rows scanned during execution |
| started_at | TIMESTAMP | Execution start timestamp |
| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique query user identifier |
| user_name | VARCHAR(100) | Display name of the query user |