Skip to content

Latest commit

 

History

History
34 lines (30 loc) · 1.44 KB

sql-execution-order.md

File metadata and controls

34 lines (30 loc) · 1.44 KB
title sidebar_label description
SQL execution order
SQL execution order
Execution order for SQL clauses in QuestDB. This covers the SQL keywords you may already be familiar with as well as extensions to the language that are unique to QuestDB.

QuestDB attempts to implement standard ANSI SQL. We also try to be compatible with PostgreSQL, although parts of this are a work in progress. QuestDB implements these clauses which have the following execution order:

  1. FROM
  2. ON
  3. JOIN
  4. WHERE
  5. LATEST ON
  6. GROUP BY (optional)
  7. WITH
  8. HAVING (implicit)
  9. SELECT
  10. DISTINCT
  11. ORDER BY
  12. LIMIT

We have also implemented sub-queries that users may execute at any part of a query that mentions a table name. The sub-query implementation adds almost zero execution cost to SQL. We encourage the use of sub-queries as they add flavors of functional language features to traditional SQL.

For more information on the SQL extensions in QuestDB which deviate from ANSI SQL and PostgreSQL, see the SQL extensions documentation.