Observe Performance Cookbook: Use Make_Events before Window Functions

Problem

A dataset using Resources or Intervals performs less well after adding an OPAL window function. You may also see a warning icon in the OPAL editor.

Solution

Insert make_event before the window function and test that the use case is still met as expected.

Explanation

Window functions over Resource or Interval datasets can be expensive because they require interval overlapping band-join. Each interval or resource has a time window during which it is valid, and referencing these objects with a temporally sensitive window function can cause larger amounts of time (and therefore data) to be included into the query. Using make_event allows Observe to temporarily consider only the relevant events from the resource or interval.

make_event
make_col avg:window(avg(x), frame(back:5m))