Skip to content

ESQL: Optimize more CASE cases #130774

Open
Open
@nik9000

Description

@nik9000

ESQL's case is lazy and so quite slow. We run it eagerly in a few cases, but not enough. I've encountered a query like:

FROM foo
| EVAL action = CASE(
    a IN ("a", "b", "c"), "a",
    a == "d", "d"
)
| WHERE action == "d"

Where we do not optimize the CASE statement here. There are two "obvious" optimizations for this:

  1. Run CASE in non-lazy mode - maybe even a switch style mode.
  2. Push the filter a == "d" into the index transitively.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions