# db query taking over 8minutes to execute after upgrading to 2.12.2

**URL:** <https://forum.mautic.org/t/db-query-taking-over-8minutes-to-execute-after-upgrading-to-2-12-2/10301>\
**Category:** Product Support\
**Created:** [March 1, 2018, 12:21pm UTC](https://forum.mautic.org/t/db-query-taking-over-8minutes-to-execute-after-upgrading-to-2-12-2/10301 "2018-03-01T12:21:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OA\_Andrew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/oa_andrew/32/497_2.png) [@OA\_Andrew](https://forum.mautic.org/u/OA_Andrew)\
**Post date:** [March 1, 2018, 12:21pm UTC](https://forum.mautic.org/t/db-query-taking-over-8minutes-to-execute-after-upgrading-to-2-12-2/10301/1 "2018-03-01T12:21:57Z")

</div>

Hi Guys

I upgraded our Mautic version to 2.12.2 (from 2.12.1) last night. Ever since the upgrade there is a query that continuously hits our database over and over again, and hogs 100% of a single cpu core. The query itself takes anything between 5 and 8 minutes to complete.

The query:

> SELECT count(l.id) as lead\_count, max(l.id) as max\_id FROM oaleads l LEFT JOIN oalead\_lists\_leads ll ON (ll.leadlist\_id = 25) AND (ll.lead\_id = l.id) AND (ll.date\_added \<= '2018-03-01 16:40:06') WHERE (EXISTS ( SELECT COUNT(id) FROM oapage\_hits zQsWTygS WHERE (zQsWTygS.lead\_id = l.id) AND (zQsWTygS.email\_id IS NULL) AND (zQsWTygS.redirect\_id IS NULL) AND (NOT EXISTS (SELECT CNxdojlk.id FROM oapage\_hits CNxdojlk WHERE (CNxdojlk.lead\_id = l.id) AND (CNxdojlk.date\_hit \> (zQsWTygS.date\_hit - INTERVAL 30 MINUTE)) AND (CNxdojlk.date\_hit \< zQsWTygS.date\_hit)) ) HAVING COUNT(id)\>1 ) ) AND (ll.lead\_id IS NULL)

This issue is causing our other applications running on the same server to timeout.

Should I roll back to the previous Mautic version?

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [October 17, 2019, 4:34pm UTC](https://forum.mautic.org/t/db-query-taking-over-8minutes-to-execute-after-upgrading-to-2-12-2/10301/2 "2019-10-17T16:34:10Z")

</div>


