If you’d like to propose a function or an operator to be supported in the SQL API,
check the existing issues on GitHub. If there are no relevant
issues, please file a new one.
SQL commands
SELECT
Synopsis:
SELECT retrieves rows from a cube.
The FROM clause specifies one or more source cube tables for the SELECT.
Qualification conditions can be added (via WHERE) to restrict the returned
rows to a small subset of the original dataset.
Example:
EXPLAIN
Synopsis:
EXPLAIN command displays the query execution plan that the Cube planner
will generate for the supplied statement.
The ANALYZE will execute statement and display actual runtime statistics,
including the total elapsed time expended within each plan node and the total
number of rows it actually returned.
Example:
ANALYZE:
SHOW
Synopsis:
name, or all runtime parameters
if ALL is specified.
Example:
SET
Synopsis:
SET command changes a session variable to a new value.
Use SET with the cube_cache session variable for cache control.
You can also set the session time zone with SET TIME ZONE (or SET TIMEZONE):
DEFAULT to reset the time zone to its default. The LOCAL form
(SET TIME ZONE LOCAL) is not supported.
SQL functions and operators
SQL API currently implements a subset of functions and operators supported by PostgreSQL. Additionally, it supports a few custom functions.Comparison operators
Learn more in the
relevant section
of the PostgreSQL documentation.
Comparison predicates
Learn more in the
relevant section
of the PostgreSQL documentation.
Mathematical functions
Learn more in the
relevant section
of the PostgreSQL documentation.
Trigonometric functions
Learn more in the
relevant section
of the PostgreSQL documentation.
String functions and operators
Learn more in the
relevant section
of the PostgreSQL documentation.
Other string functions
Learn more in the
relevant section
of the PostgreSQL documentation.
Pattern matching
Learn more in the
relevant section
of the PostgreSQL documentation.
Data type formatting functions
Learn more in the
relevant section
of the PostgreSQL documentation.
Date/time functions
Learn more in the
relevant section
of the PostgreSQL documentation.
Conditional expressions
Learn more in the
relevant section
of the PostgreSQL documentation.
General-purpose aggregate functions
Learn more in the
relevant section
of the PostgreSQL documentation.
In projections in inner parts of post-processing queries:
AVG,COUNT,MAX,MIN, andSUMcan only be used with measures of compatible types.- If
COUNT(*)is specified, Cube will query the first measure of typecountof the relevant cube.
PERCENTILE_CONT pushdown is only available on data sources whose SQL dialect
supports it. It is not supported with BigQuery, ClickHouse, Microsoft SQL Server,
MySQL, or Presto.Aggregate functions for statistics
Learn more in the
relevant section
of the PostgreSQL documentation.
Window functions
Learn more in the
relevant section
of the PostgreSQL documentation.
- Aggregate functions used as window functions — any supported aggregate
function (such as
SUM,AVG,COUNT,MIN, orMAX) combined with anOVER (...)clause. - The
LAGandLEADwindow functions:
Row and array comparisons
Learn more in the
relevant section
of the PostgreSQL documentation.
Custom functions
See the XIRR recipe for more details.