# Sql query audit\_events, why so slow?

**URL:** <https://forum.inductiveautomation.com/t/sql-query-audit-events-why-so-slow/56883>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [March 5, 2022, 10:46am UTC](https://forum.inductiveautomation.com/t/sql-query-audit-events-why-so-slow/56883 "2022-03-05T10:46:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [March 5, 2022, 10:46am UTC](https://forum.inductiveautomation.com/t/sql-query-audit-events-why-so-slow/56883/1 "2022-03-05T10:46:37Z")

</div>

SQL query audit\_events, why so slow?

SELECT “AUDIT\_EVENTS\_ID”,“ACTION”,“ACTION\_TARGET”,“ACTION\_VALUE”,“ACTOR”,“EVENT\_TIMESTAMP” FROM audit\_events

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/d/3df2e9f94c02d38c99985cea492cc8b34b769d00.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 5, 2022, 2:56pm UTC](https://forum.inductiveautomation.com/t/sql-query-audit-events-why-so-slow/56883/2 "2022-03-05T14:56:02Z")

</div>

The “LIMIT” option has no effect if Ignition can’t figure out how to insert the necessary clause (or misplaces it due to UNION or other odd clauses). And even if present, a query like yours may have to scan the entire table anyways, before it can apply the LIMIT.

Use a WHERE clause that includes columns that are indexed.

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [March 6, 2022, 9:31am UTC](https://forum.inductiveautomation.com/t/sql-query-audit-events-why-so-slow/56883/3 "2022-03-06T09:31:00Z")

</div>

Yeah！I develop a new Page，first use sql bind limit 100 data.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/f/7f02feebabd46f3458e735608f502e6b18a751b1.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/0/d08e5210e95a32163f67cadcaa3a3b6f954e0a62.png)

But first reload still have about a little seconds later.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 6, 2022, 1:34pm UTC](https://forum.inductiveautomation.com/t/sql-query-audit-events-why-so-slow/56883/4 "2022-03-06T13:34:35Z")

</div>

Let me repeat:

Use a WHERE clause that includes columns that are indexed.
