Hi team, I want to know when to use nested columns...
# general
s
Hi team, I want to know when to use nested columns and when to use flat nested columns. From the Druid document, https://druid.apache.org/docs/latest/querying/nested-columns/
An optimized virtual column allows Druid to read and filter these values at speeds consistent with standard Druid LONG, DOUBLE, and STRING columns.
It looks like we don't need to flatten the nested columns since the performance may be similar. Is there a case of not using the nested columns but flattening the nested field?
j
Hi Sam, flattening may have been in the product prior to nested columns ... so nested columns was added to provide additional flexibility and convenience. Fields within the nested columns are physically stored in columnar format, and all are dictionary encoded and indexed. This is actually a bit better than top level columns, in which only string columns are dictionary encoded and indexed (numeric top level columns except the new "auto" columns are not) I have seen datasources configured both ways. My recommendation would be to store highly tenant-variable and sparse attributes within a nested "properties" field to simplify the schema and allow for schema evolution with minimal maintenance.
s
Thank you John! This is very helpful!