SELECT Statement

Retrieve rows from one or more ChaosSearch views.

Use the SELECT statement to retrieve rows from one or more ChaosSearch views. The returned data is referred to as the results, or the result set.

Synopsis

SELECT [ ALL | DISTINCT ] select_expr [, ...]
[ FROM from_item [, ...] ]
[ WHERE condition ]
[ GROUP BY [ ALL | DISTINCT ] grouping_element [, ...] ]
[ HAVING condition]
[ [ ALL | DISTINCT ] select ]
[ ORDER BY expression [ ASC | DESC ] [, ...] ]
[ { LIMIT [ count | ALL ] } ]

The ALL and DISTINCT quantifiers control whether duplicate rows are included in the result set. If you include ALL, all records including possible all rows are included. If you specify DISTINCT, only unique rows are in the result set. If neither argument is specified, the default behavior is ALL.

For ChaosSearch SQL queries, the from_item value is the name of a Refinery view, and join_type is currently an INNER JOIN type:

view_name [ [ AS ] alias [ ( column_alias [, ...] ) ] ]

view1 join_type view2 [ ON join_condition | USING ( join_column [, ...] ) ]

🚧

Limits for DISTINCT and GROUP BY

SELECT DISTINCT has a limit of 1 million distinct values.

GROUP BY` has a default limit of 1000 results if a limit is not otherwise specified by the user. During BETA, it is recommended that users specify a limit in queries and use a limit value of 1000 or less.

The grouping_element can be as follows:

()
expression

Example