# Anyone Ever add a non-clustered index to the tagid in the sqlt\_data partition tables?

**URL:** <https://forum.inductiveautomation.com/t/anyone-ever-add-a-non-clustered-index-to-the-tagid-in-the-sqlt-data-partition-tables/97680>\
**Category:** Ignition\
**Tags:** database\
**Created:** [October 23, 2024, 4:26pm UTC](https://forum.inductiveautomation.com/t/anyone-ever-add-a-non-clustered-index-to-the-tagid-in-the-sqlt-data-partition-tables/97680 "2024-10-23T16:26:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmahaf](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tmahaf/32/23492_2.png) [@tmahaf](https://forum.inductiveautomation.com/u/tmahaf)\
**Post date:** [October 23, 2024, 4:26pm UTC](https://forum.inductiveautomation.com/t/anyone-ever-add-a-non-clustered-index-to-the-tagid-in-the-sqlt-data-partition-tables/97680/1 "2024-10-23T16:26:22Z")

</div>

When you look at the query is generated with system.tag.queryTagHistory(), it uses 'WHERE tagid IN (tagid1,tagid2....)

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

Curious if a clustered index might help speed up some of the queries that have a lot of tagids

Thanks!

---

<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:** [October 23, 2024, 4:58pm UTC](https://forum.inductiveautomation.com/t/anyone-ever-add-a-non-clustered-index-to-the-tagid-in-the-sqlt-data-partition-tables/97680/2 "2024-10-23T16:58:55Z")

</div>

Yes, a multicolumn index on `t_stamp` and `tagid` will help.

---

<div class="post-metadata">

**Author:** ![tmahaf](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tmahaf/32/23492_2.png) [@tmahaf](https://forum.inductiveautomation.com/u/tmahaf)\
**Post date:** [October 23, 2024, 4:59pm UTC](https://forum.inductiveautomation.com/t/anyone-ever-add-a-non-clustered-index-to-the-tagid-in-the-sqlt-data-partition-tables/97680/3 "2024-10-23T16:59:22Z")

</div>

Thanks!!!!
