Skip to content

Conversation

@dnhatn
Copy link
Member

@dnhatn dnhatn commented Aug 22, 2025

Avoids iterating the DISI when reading a sparse metric field if its nulls were already filtered by a WHERE clause (e.g., metrics != NULL). Iterating the DISI on a sparse field can be expensive. From my local benchmark, the query time of

TS my* | WHERE `metrics.system.memory.utilization` IS NOT NULL AND @timestamp >= \"2025-07-25T14:55:59.000Z\" AND @timestamp <= \"2025-07-25T16:25:59.000Z\" | STATS AVG(AVG_OVER_TIME(`metrics.system.memory.utilization`)) BY host.name, BUCKET(@timestamp, 1h) | LIMIT 10000" 

decreased from 35ms to 27ms (20%).

Before:
before

After:

after
Copy link
Contributor

@kkrik-es kkrik-es left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I'm glad my draft has some overlap :)

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I left minor comments and we need a test for tryReadDoubles() in ES819TSDBDocValuesFormatTests

@dnhatn dnhatn force-pushed the skip-disi-metric-field branch from 23874ce to 46085ab Compare August 27, 2025 23:41
@dnhatn dnhatn force-pushed the skip-disi-metric-field branch from 46085ab to 6bb2a4a Compare August 28, 2025 00:10
@dnhatn dnhatn force-pushed the skip-disi-metric-field branch from 43831ab to 9fd96a3 Compare August 28, 2025 05:26
@dnhatn
Copy link
Member Author

dnhatn commented Aug 28, 2025

@martijnvg @kkrik-es I've updated this with Kostas's PR. I think it looks better. Can you take a look? Thanks!

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@elasticsearchmachine
Copy link
Collaborator

Hi @dnhatn, I've created a changelog YAML for you.

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Nhat!

Copy link
Contributor

@kkrik-es kkrik-es left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and clean!

@dnhatn
Copy link
Member Author

dnhatn commented Aug 28, 2025

@martijnvg @kkrik-es Thank you!

@dnhatn dnhatn merged commit d8ea894 into elastic:main Aug 28, 2025
30 of 33 checks passed
@dnhatn dnhatn deleted the skip-disi-metric-field branch August 28, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment