# Maybe there should be an option to capture DB query values?

**URL:** <https://discuss.elastic.co/t/maybe-there-should-be-an-option-to-capture-db-query-values/247753>\
**Category:** APM\
**Tags:** java\
**Created:** [September 7, 2020, 10:07am UTC](https://discuss.elastic.co/t/maybe-there-should-be-an-option-to-capture-db-query-values/247753 "2020-09-07T10:07:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![giovere](https://avatars.discourse-cdn.com/v4/letter/g/e9bcb4/32.png) [@giovere](https://discuss.elastic.co/u/giovere)\
**Post date:** [September 7, 2020, 10:07am UTC](https://discuss.elastic.co/t/maybe-there-should-be-an-option-to-capture-db-query-values/247753/1 "2020-09-07T10:07:20Z")

</div>

Recently I was diagnosing performance issues, I wish I had the option to log database query values.  
In general, I think it could be a great option to have, especially useful on dev/test setups.  
I know it is not supported, because values might contain sensitive data, but wouldn't it be helpful to have this option, where APM administrators can decide if it should be enabled?  
`enable_log_correlation` did not changed anything for me, since I have no log to correlate spans with, probably should ask developers to log queries, but that is going to take a lot of time and it could not be solution for everyone.  
Is there maybe some other option I'm missing to get db-query values?

Personally I bumped into two problems, which could be easily diagnosed using knowing values:

1. The value behind ? was "%" + query + "%", leading "%" prevents index usage and query was slow.
2. In our application one request triggers around 1000 queries, all of them are identical and query #666 spends x10 times more time than others.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [September 8, 2020, 6:15am UTC](https://discuss.elastic.co/t/maybe-there-should-be-an-option-to-capture-db-query-values/247753/2 "2020-09-08T06:15:14Z")

</div>

Hi @giovere and welcome to the forum!

So far we decided not to implement that, but you can upvote the related [issue](https://github.com/elastic/apm/issues/220) . If there's interest, we may reconsider in the future.

> [@giovere](#):
>
> query #666 spends x10 times more time than others

That sounds spooky 😨

Jokes aside, I can definitely see the value.

---

<div class="post-metadata">

**Author:** ![giovere](https://avatars.discourse-cdn.com/v4/letter/g/e9bcb4/32.png) [@giovere](https://discuss.elastic.co/u/giovere)\
**Post date:** [September 8, 2020, 6:59am UTC](https://discuss.elastic.co/t/maybe-there-should-be-an-option-to-capture-db-query-values/247753/3 "2020-09-08T06:59:15Z")

</div>

Hi @Eyal_Koren  
Thanks for the issue link, somehow missed it when searching for it, already added my humble +1.

---

<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:** [September 29, 2020, 2:59am UTC](https://discuss.elastic.co/t/maybe-there-should-be-an-option-to-capture-db-query-values/247753/4 "2020-09-29T02:59:24Z")

</div>

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