Query opmitizer in druid

Does druid have a query optimizer (same as any database)?
Are there any rules to how to write your query (always use equals, avoid using OR operators)?

How does druid optimizer the query?

Cheers,

Rotem.

Hey Rotem,

Druid’s native query language by and large it does what you tell it to do, with only minor optimizations. In general it pays to write your Druid queries in the “simplest” form you can think of. By “keep it simple” I mean things like: don’t ask for fields you don’t need, don’t include two aggregators that do the same thing, don’t use a bound filter when a selector will do, etc. It also pays to select the best query type. Generally in performance, timeseries beats topN which beats groupBy. Check out the docs for all three query types to see which one is best for you.

We’re working on a built-in SQL layer that will do more optimizations on its own (including making all of the above choices) but that isn’t in a release yet.