# How can I find the query that is eating up my memory?

**URL:** <https://discuss.elastic.co/t/how-can-i-find-the-query-that-is-eating-up-my-memory/285930>\
**Category:** Elasticsearch\
**Created:** [October 5, 2021, 1:46pm UTC](https://discuss.elastic.co/t/how-can-i-find-the-query-that-is-eating-up-my-memory/285930 "2021-10-05T13:46:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spdoes](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@spdoes](https://discuss.elastic.co/u/spdoes)\
**Post date:** [October 5, 2021, 1:46pm UTC](https://discuss.elastic.co/t/how-can-i-find-the-query-that-is-eating-up-my-memory/285930/1 "2021-10-05T13:46:04Z")

</div>

Hello guys,  
I did set the slowlogs to minimum time but when I read it all and try to find pattern by timestamp, all queries seems lightweight and are taking less than 500ms.

is there a way to know **the effect of each query to the jvm memory pressure ?**

![ec46d71128d906fe6cf08150f69bb158d3ff2b35](https://us1.discourse-cdn.com/elastic/original/3X/8/d/8df14a30fb3718b55973dd0fd5dab24b9fd48178.png)

**Am I looking at this the wrong way ?**

**Followup question** : any solution to keep it constant ? I tried to regularly running the clear cache API, but it does not seems to reduce the memory usage (was it suppose to reduce it ?) `POST /xxx/_cache/clear`

---

<div class="post-metadata">

**Author:** ![spdoes](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@spdoes](https://discuss.elastic.co/u/spdoes)\
**Post date:** [October 7, 2021, 12:29pm UTC](https://discuss.elastic.co/t/how-can-i-find-the-query-that-is-eating-up-my-memory/285930/2 "2021-10-07T12:29:17Z")

</div>

**Again this happened even after I increased the JVM memory from 30 to 40GB**

Near these red columns, suddenly the system started to eating up a lot of memory.

Funny thing is that the reason is not the system load, nor index memory, nor CPU utilizando oi I/O Ops.

You can see a decrease the activity because it hit a circuit break and crashed.

 ![Screen Shot 2021-10-07 at 09.25.35](https://us1.discourse-cdn.com/elastic/original/3X/b/c/bc9844f3bd5e704d4f9a1e0ad2e3f29c64ed9960.jpeg)

 ![Screen Shot 2021-10-07 at 09.25.45](https://us1.discourse-cdn.com/elastic/original/3X/7/d/7dee8ce0284309e0f8c73b5753deed0dd9329335.jpeg)

Looking at the query slowlogs I don't see anything different.  
I am lost here...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2021, 12:29pm UTC](https://discuss.elastic.co/t/how-can-i-find-the-query-that-is-eating-up-my-memory/285930/3 "2021-11-04T12:29:57Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
