This message was deleted.
# troubleshooting
s
This message was deleted.
v
It is important to note that the concept of aggregation (or aggregates) is not unique to Druid and is a general SQL concept (or a general data concept really - it goes beyond SQL). You can learn more about aggregation in SQL in general by searching for what is sql aggregation (here is one result from such a search https://www.geeksforgeeks.org/aggregate-functions-in-sql/). Once you have a good grasp on that concept there are three things you should know when applying that knowledge to Druid specifically: (1) As well as the common aggregates like
COUNT
,
SUM
,
MAX
etc, Druid supports really fancy sketch based aggregations that let you do things like compute (approximate) uniques and quantiles and much more very quickly (as Sergio noted). (2) In Druid it is also common (but not required!) to aggregate or "rollup" your data at ingest time so that the data in Druid is partially aggregated already. (see https://druid.apache.org/docs/latest/tutorials/tutorial-rollup.html). (3) When reading about aggregation in Druid keep in mind that as well as SQL Druid also has a JSON based language for expressing queries and ingestion jobs (you will see it in the docs). In the JSON based language "aggregates" are called "metrics" and a metric spec like
{ "type": "count", "name": "cnt" }
means the same
COUNT(*) AS "cnt"
in SQL. The good news is that as of Druid 24.0 it is possible to do both ingestion and querying via SQL so you could avoid needing to interact with the JSON based form.