# Database Fault and ResultWriter Error

**URL:** <https://forum.inductiveautomation.com/t/database-fault-and-resultwriter-error/43630>\
**Category:** Ignition\
**Created:** [February 19, 2021, 6:05pm UTC](https://forum.inductiveautomation.com/t/database-fault-and-resultwriter-error/43630 "2021-02-19T18:05:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kstewart](https://avatars.discourse-cdn.com/v4/letter/k/dbc845/32.png) [@kstewart](https://forum.inductiveautomation.com/u/kstewart)\
**Post date:** [February 19, 2021, 6:05pm UTC](https://forum.inductiveautomation.com/t/database-fault-and-resultwriter-error/43630/1 "2021-02-19T18:05:22Z")

</div>

I have created many of our pages to use historical tags and values to fill many of the components. After doing so I have been having problems with one of our databases faulting out due to too many connections. Many of the queries that are running are taking around 6-9 seconds to execute, all of the queries that are doing this are system queries that are pulling tag history to our components.

 ![Longest Recent Queries](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/0/702a500622db4845ee916fae1d1fa57e6c01b660.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:** [February 19, 2021, 6:36pm UTC](https://forum.inductiveautomation.com/t/database-fault-and-resultwriter-error/43630/2 "2021-02-19T18:36:47Z")

</div>

That often means indices are missing in your data tables. Ensure you have separate indices on the `tagid` column and the `t_stamp` column in each of your `sqlt_data_*` tables.

---

<div class="post-metadata">

**Author:** ![kstewart](https://avatars.discourse-cdn.com/v4/letter/k/dbc845/32.png) [@kstewart](https://forum.inductiveautomation.com/u/kstewart)\
**Post date:** [February 19, 2021, 7:31pm UTC](https://forum.inductiveautomation.com/t/database-fault-and-resultwriter-error/43630/3 "2021-02-19T19:31:25Z")

</div>

I checked each table has a clustered primary key on the tagid column and the t\_stamp column and an addition nonclusted index on the t\_stamp column.

---

<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:** [February 19, 2021, 7:32pm UTC](https://forum.inductiveautomation.com/t/database-fault-and-resultwriter-error/43630/4 "2021-02-19T19:32:17Z")

</div>

I recommend you add a non-clustered index on the tagid column, too.
