Observe Performance Cookbook: Filter Earlier in OPAL Scripts¶
Problem¶
A query using filtering in OPAL is taking a long time or using a lot of query credits.
Solution¶
Move filtering verbs (such as filter
, ever
, or exists
) as early as possible in your OPAL script.
Explanation¶
These verbs reduce the data volume and make downstream operations faster. Our optimizer strives to automatically perform this optimization, but it is still a good practice to do it manually.
Better
filter stream="stderr"
make_col kvs:parse_kvs(log)
make_col cid:string(kvs.customer_id)
Less Good
make_col kvs:parse_kvs(log)
make_col cid:string(kvs.customer_id)
filter stream="stderr"