always predicate: bool, [frame(...)]?

Keeps every row whose primary-key group had the predicate evaluate to true on every grouped row inside the chosen time window.

On a Resource dataset, that means every state in scope must satisfy the predicate; on other datasets with a primary key, each group is all rows sharing that key. The input must have a non-empty primary key (otherwise the compiler reports that the verb is used to filter grouped rows and suggests filter instead). Pair with ever for “at least once true” and never for “never true.”

The predicate must be bool. An optional second argument is frame using back and/or ahead only—start and end are not allowed. On temporal inputs without a frame, the compiler evaluates the condition over the query window and then compares groups, which is not accelerable; with a frame, accelerable predicates can accelerate. On a non-temporal (table) input, supplying frame() still produces an accelerable windowed plan. When the predicate is time-immutable or the input is non-temporal, the stage strength-reduces to an ordinary filter on the predicate.

A group fails always(pred) if any row has pred false or null (unknown is not treated as true everywhere in the group).

Categories

Accelerable

always is accelerable if there is a frame() argument. A dataset that only uses accelerable verbs can be accelerated, making queries on the dataset respond faster.

Examples

always string(status_code) = "200"

Keeps every interval for hosts whose HTTP status was 200 on every row in the query window, dropping hosts that ever reported another code.

always string(status_code) = "200", frame(back:30m)

Requires every sample in the trailing thirty minutes relative to each row’s timestamp to have status 200, using frame(back:30m) for the accelerable windowed form.

always bytesUsed < 20000000

Assuming deviceId is the primary key, returns all rows only for devices that stayed below twenty megabytes on every observation, not merely the rows that individually satisfy the comparison.