Skip to main content
SQL API supports the following commands as well as functions and operators.
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:
The 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:
With ANALYZE:

SHOW

Synopsis:
Returns the value of a runtime parameter using name, or all runtime parameters if ALL is specified. Example:

SET

Synopsis:
The SET command changes a session variable to a new value. Use SET with the cube_cache session variable for cache control.

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, and SUM can only be used with measures of compatible types.
  • If COUNT(*) is specified, Cube will query the first measure of type count of the relevant cube.

Aggregate functions for statistics

Learn more in the relevant section of the PostgreSQL documentation.

Row and array comparisons

Learn more in the relevant section of the PostgreSQL documentation.

Custom functions

See the XIRR recipe for more details.