When it comes to materialized views (MVs) in Azure Data Explorer (ADX), the encoding policy of the source table columns is not preserved in the MV. The encoding policies applied to the source table columns are ignored when the data is stored in the materialized view. Instead, you can set the encoding policy for the MV columns separately, which allows you to optimize the storage and query performance as needed.
Regarding your specific questions:
- Is this officially supported? Yes, altering the encoding policy for the MV columns is supported, and it is a standard practice to optimize performance. Prefixing the MV name with "MV_" is not a hack; it is a way to differentiate the MV from other tables and ensure clarity in your schema.
- Does it actually change how the data is stored in the MV, or is it just ignored? Setting the encoding policy for the MV does change how the data is stored in the MV. The encoding policy you apply will be effective for the data in the MV.
- Would you recommend using a non-default encoding policy in my case? Yes, using a non-default encoding policy can be beneficial depending on your use case. For example, using "Identifier" for high cardinality columns can improve query performance, while "BigObject" can help reduce storage size for large text fields. It is advisable to evaluate your specific data access patterns and storage requirements before finalizing the encoding policies.
References: