# Named query monitoring/profiling

**URL:** <https://forum.inductiveautomation.com/t/named-query-monitoring-profiling/20142>\
**Category:** Ignition\
**Tags:** namedqueries\
**Created:** [October 15, 2018, 8:02am UTC](https://forum.inductiveautomation.com/t/named-query-monitoring-profiling/20142 "2018-10-15T08:02:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [October 15, 2018, 8:02am UTC](https://forum.inductiveautomation.com/t/named-query-monitoring-profiling/20142/1 "2018-10-15T08:02:28Z")

</div>

I’m trying to use named queries with long cache times to ease a connection to an old DB (FoxPro).

However, when looking at the DB diagnostics, I have a feeling that some queries are still fired too often.

Is there some way I can monitor the queries send to the server (preferable via some option I can enable for a few minutes, and later investigate the data)?

I would like to find some data like

- source of the query (client hostname or ip)
- Time and duration of the query
- whether it hit the cache or went to the database
- parameters passed on

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [October 15, 2018, 2:28pm UTC](https://forum.inductiveautomation.com/t/named-query-monitoring-profiling/20142/2 "2018-10-15T14:28:41Z")

</div>

Turning the logger “NamedQueries.executor” to trace will get you information on the parameters, whether it hit the cache or db and the expiration time of cached queries.

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [October 18, 2018, 2:11pm UTC](https://forum.inductiveautomation.com/t/named-query-monitoring-profiling/20142/3 "2018-10-18T14:11:24Z")

</div>

Ok, I got some time to trace things, and found that most of the time, the cache was hit.

Though I found something weird, how is the cache supposed to stay valid until the year 9377, when I only enabled a cache of 2 minutes on it? I’m using 7.9.9 btw.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/adf8c9ecf453ffe31dd22a087cfd5651a78e23fe.png)

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [October 18, 2018, 3:34pm UTC](https://forum.inductiveautomation.com/t/named-query-monitoring-profiling/20142/4 "2018-10-18T15:34:11Z")

</div>

> how is the cache supposed to stay valid until the year 9377, when I only enabled a cache of 2 minutes on it?

You're living in the future? 😳

I'll have our defect analyst take a look at that. Yikes.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 18, 2018, 3:58pm UTC](https://forum.inductiveautomation.com/t/named-query-monitoring-profiling/20142/5 "2018-10-18T15:58:36Z")

</div>

> [@Sanderd17](#):
>
> Though I found something weird, how is the cache supposed to stay valid until the year 9377, when I only enabled a cache of 2 minutes on it? I'm using 7.9.9 btw.

The logging is turning a nano-second timestamp into a date - the logic is all fine, but the debug logging is (obviously) incorrect. We'll have to fix it internally.
