Observe Performance Cookbook: Type Data Columns

Problem

There are slow queries related to data with a column extracted from a JSON column.

Solution

Use the Column header to convert variant columns to specific types such as string or int64. In OPAL, examples of applicable functions are string, int64, and parse_timestamp.

Explanation

A field extracted from a JSON column has the type of variant. Processing variant values can be significantly more expensive in query execution and transform execution. Observe recommends casting fields that are extracted from a JSON column to an explicit type (for instance, use make_col cluster_uid:string(FIELDS.cluster_uid) instead of make_col cluster_uid:FIELDS.cluster_uid).