# Custom DB Query extension not providing the correct count

**URL:** <https://community.dynatrace.com/t/custom-db-query-extension-not-providing-the-correct-count/56516>\
**Category:** Extensions\
**Tags:** databases, sql, extensions\
**Created:** [July 21, 2026, 12:59pm UTC](https://community.dynatrace.com/t/custom-db-query-extension-not-providing-the-correct-count/56516 "2026-07-21T12:59:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdavison2](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@tdavison2](https://community.dynatrace.com/u/tdavison2)\
**Post date:** [July 21, 2026, 12:59pm UTC](https://community.dynatrace.com/t/custom-db-query-extension-not-providing-the-correct-count/56516/1 "2026-07-21T12:59:30Z")

</div>

Hello,

I’ve created a Custom Extension that runs a SQL Query that just provides a “count”.&nbsp; This runs every 1 min, but, the returned count is not accurate.&nbsp; It should be around 60+ per minute, but Dynatrace is showing single digit counts.&nbsp; Also, it looks like it skips a minute occassionally.&nbsp; I can run the query manually in SSMS and see the counts that I expect.

 ![tdavison76_0-1784638524417.png](https://global.discourse-cdn.com/dynatrace/original/2X/5/5d1c93e892f96d0200a72ffb6c06cbd70bb247a6.png)

Here’s the query:

```markup
select count(*) as [count]
from [Mercury].[dbo].[OrderShipmentActual] (nolock)
where [CreateDate] > dateadd(mi, -1, getdate());

```

Here’s how the extension is configured:

 ![tdavison76_1-1784638688093.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/1/310feba7f28dc7b07781e6ed1982121187d50aed.png)

Any idea how to resolve this and get the correct counts?

Thank you for any help on this one.

Tom

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [July 21, 2026, 1:26pm UTC](https://community.dynatrace.com/t/custom-db-query-extension-not-providing-the-correct-count/56516/2 "2026-07-21T13:26:03Z")

</div>

[@tdavison76](https://community.dynatrace.com/user/100398)&nbsp;,

Looks like the missing points might be from timeouts. Normally the timeout is 10 seconds, so put something higher, and let’s check afterwards.

---

<div class="post-metadata">

**Author:** ![tdavison2](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@tdavison2](https://community.dynatrace.com/u/tdavison2)\
**Post date:** [July 21, 2026, 2:26pm UTC](https://community.dynatrace.com/t/custom-db-query-extension-not-providing-the-correct-count/56516/3 "2026-07-21T14:26:42Z")

</div>

Hello Antonio, thank you for the help, I’ve modified the Query and Interval to be 5 min instead of 1.

 ![tdavison76_0-1784643770707.png](https://global.discourse-cdn.com/dynatrace/original/2X/7/74c3a60dec9232498c2fd407a641a497d43206b4.png)

Still seeing incorrect counts and looks like even more gaps.&nbsp; e.g.&nbsp; The below chart is showing a 25 count at 10:05, and the next count is only 2 and doesn’t occur until 10:20am.&nbsp; The SQL Query and 5 min intervals should be showing a count of 300+ every 5 min.

 ![tdavison76_1-1784643985203.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/6/a6dfec831002f03d66dabcfd0293fa25ce522267.png)

Thanks again for the help

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [July 22, 2026, 8:14am UTC](https://community.dynatrace.com/t/custom-db-query-extension-not-providing-the-correct-count/56516/4 "2026-07-22T08:14:55Z")

</div>

[@tdavison76](https://community.dynatrace.com/user/100398)&nbsp;,

You have a timeout of 30 seconds. It cannot be greater than the period, but if you have 5 minutes, try 300 seconds for the timeout.
