# queryTagHistory Slow Data Transfer

**URL:** <https://forum.inductiveautomation.com/t/querytaghistory-slow-data-transfer/10213>\
**Category:** Ignition\
**Created:** [July 10, 2015, 9:37pm UTC](https://forum.inductiveautomation.com/t/querytaghistory-slow-data-transfer/10213 "2015-07-10T21:37:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwb04001](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@jwb04001](https://forum.inductiveautomation.com/u/jwb04001)\
**Post date:** [July 10, 2015, 9:37pm UTC](https://forum.inductiveautomation.com/t/querytaghistory-slow-data-transfer/10213/1 "2015-07-10T21:37:11Z")

</div>

Hi,

I need to query a large amount of historical data. I’m using the queryTagHistory function in order to get the data in the proper format.

```auto
Historical_dataset = system.tag.queryTagHistory(paths, startDate, endDate)
```

This is the query that Ignition sends to MySQL:

```auto
SELECT `tagid`,`intvalue`,`floatvalue`,`stringvalue`,`datevalue`,`t_stamp`,`dataintegrity` FROM sqlt_data_1_2015_07 WHERE `t_stamp`>=1435730400000 and `t_stamp`<=1436594399999 and (`tagid`=64 OR `tagid`=65 OR `tagid`=66 OR `tagid`=67 OR `tagid`=68 OR `tagid`=69 OR `tagid`=72 OR `tagid`=73 OR `tagid`=74 OR `tagid`=75 OR `tagid`=76 OR `tagid`=77 OR `tagid`=78 OR `tagid`=79 OR `tagid`=80 OR `tagid`=81 OR `tagid`=82 OR `tagid`=83 OR `tagid`=84 OR `tagid`=85 OR `tagid`=86 OR `tagid`=44 OR `tagid`=45 OR `tagid`=46 OR `tagid`=47 OR `tagid`=48 OR `tagid`=49 OR `tagid`=50 OR `tagid`=51 OR `tagid`=52 OR `tagid`=53 OR `tagid`=54 OR `tagid`=55 OR `tagid`=56 OR `tagid`=57 OR `tagid`=60 OR `tagid`=61 OR `tagid`=62 OR `tagid`=63) ORDER BY `t_stamp` ASC
```

The query returns 26MB of data (about 550,000 lines of data). When I run the Ignition script, MySQL shows that the query runs and sends in about a second. However, the Database Connections Status page on the Ignition Gateway shows the query is active for about 45 seconds. During that time, my client freezes up. After Ignition shows the database connection closed, the rest of my script runs normally.

Has anyone else experienced this? Is this normal when querying a large amount of data using queryTagHistory? Is there anything I can do to speed it up? Any advice/ideas would be appreciated.

I’m running Ignition version 7.7.4 on Windows Server 2008. I have a MySQL database installed on the same virtual machine.

Thanks!

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [July 13, 2015, 7:37pm UTC](https://forum.inductiveautomation.com/t/querytaghistory-slow-data-transfer/10213/2 "2015-07-13T19:37:22Z")

</div>

Check out this [thread](https://inductiveautomation.com/forum/viewtopic.php?f=81&t=6003) for some ideas.
