Impala workload management use cases

Learn how to use query history to track executed queries by user, identify frequently queried statements, and report long-running queries for analysis.

A consolidated view of reports from previously executed queries can be useful in the following use cases:
  • Collecting history of all queries run and reporting by user, start/end time, and execution duration. For instance:
    SELECT db_user, start_time, end_time, total_time_ms, sql FROM impala_query_log ORDER BY db_user;
  • Collecting the top five most frequently executed queries. For instance:
    SELECT lower(sql) sql, count(sql) count FROM sys.impala_query_log GROUP BY lower(sql) ORDER BY count desc LIMIT 5;
  • Reporting on queries that ran over 10 minutes. For instance:
    SELECT db_user, total_time_ms, sql FROM sys.impala_query_log WHERE total_time_ms > 600000;
  • Reporting on queries that are actively running and have been running for over 10 minutes. For instance:
    SELECT db_user, total_time_ms, sql FROM sys.impala_query_live WHERE total_time_ms > 600000;