QuestDB groups aggregation results implicitly and does not require the GROUP BY keyword. It is only supported for convenience. Using the GROUP BY clause explicitly will return the same results as if the clause was omitted.

    Examples

    The below queries perform aggregations on a single key. Using explicitly or implicitly yields the same results:

    1. SELECT sensorId, avg(temp)
    1. SELECT sensorId, sensorType, avg(temp)
    2. FROM readings;

    When used explicitly, the list of keys in the clause must match the list of keys in the SELECT clause, otherwise an error will be returned:

    1. GROUP BY a, b;