Skip to content
Lucas Lessa
Voltar para as notícias
DatabricksGAImpacto: Médio

Query history system table is now generally available

The system.query.history system table is GA to access records of queries run on SQL warehouses or serverless compute.

O que mudou

The system.query.history system table is now generally available (GA). It centralizes query execution logs across your entire account, allowing you to audit response times, statuses, and compute origins.

Use cases

Imagine you need to audit query performance across multiple workspaces and identify heavy workloads. With this table, you can:

  • Query the execution status of statements run on SQL warehouses or serverless compute.
  • Analyze detailed duration metrics, such as queue wait times and compilation times.
  • Track the origin of queries executed by notebooks, jobs, or BI tools.

How to use

Access the data directly via SQL using the standard system table path.

SELECT 
  statement_id,
  execution_status,
  total_duration_ms,
  executed_by
FROM 
  system.query.history
WHERE 
  start_time >= current_date() - interval 7 days
ORDER BY 
  total_duration_ms DESC
LIMIT 10;

What happens in this code:

  1. The query reads execution history directly from the system.query.history system table.
  2. It filters for queries executed over the last 7 days using the start time column.
  3. It sorts the results by the slowest queries based on total duration in milliseconds.
  4. It returns the top 10 longest-running executions for review.

Limitations and requirements

  • Records are typically available within one hour of execution.
  • By default, only account admins have direct access to the system table.
  • The full statement text returns as <REDACTED> unless accessed by admins or members of the databricks_pii_access group.
Ver nota oficial do Databricks

The query history system table is now generally available

Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.

Relacionadas