# Why isn't my query hitting my pre-aggregation?

**URL:** <https://community.embeddable.com/t/why-isnt-my-query-hitting-my-pre-aggregation/95>\
**Category:** Support Forum\
**Created:** [February 19, 2025, 11:47am UTC](https://community.embeddable.com/t/why-isnt-my-query-hitting-my-pre-aggregation/95 "2025-02-19T11:47:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ella-embeddable](https://dub1.discourse-cdn.com/flex013/user_avatar/community.embeddable.com/ella-embeddable/32/15_2.png) [@ella-embeddable](https://community.embeddable.com/u/ella-embeddable)\
**Post date:** [February 19, 2025, 11:47am UTC](https://community.embeddable.com/t/why-isnt-my-query-hitting-my-pre-aggregation/95/1 "2025-02-19T11:47:04Z")

</div>

Building pre-aggregations can allow you to take queries from a 5-minute loading time to **under a second** - great news! However, you might set up your pre-aggregation and find sometimes your query is still hitting your database.

For example, let’s say you have a pre-aggregation set up with the granularity “month”. This means that any combination of whole months should hit the pre-aggregation.  
If you want to test this, you can do so in [Cube’s playground](https://github.com/embeddable-hq/vanilla-components/blob/main/README.md#debugging-data-models) by trying different combinations of date ranges and seeing which get accelerated or not.

An example: if you apply a filter asking for 1st June to 31st August on your pre-aggregation that has the “month” granularity, then it can use a monthly pre-aggregation (by adding June, July and August together).  
But if you ask for 1st June 11:00 to 1st September 11:00, even though it’s the same range of time, Cube can’t match this to a monthly pre-aggregation, as that pre-aggregation only has data from midnight to midnight, so no combination of the pre-aggregated data will give an accurate result. So it will miss the cache (as it should).
