# Limiting Tag Historian Memory Usage

**URL:** <https://forum.inductiveautomation.com/t/limiting-tag-historian-memory-usage/21880>\
**Category:** Ignition\
**Created:** [January 15, 2019, 1:58am UTC](https://forum.inductiveautomation.com/t/limiting-tag-historian-memory-usage/21880 "2019-01-15T01:58:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mriederer](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@mriederer](https://forum.inductiveautomation.com/u/mriederer)\
**Post date:** [January 15, 2019, 1:58am UTC](https://forum.inductiveautomation.com/t/limiting-tag-historian-memory-usage/21880/1 "2019-01-15T01:58:41Z")

</div>

Hi All,

I’m looking for a way to limit the amount of memory allocated to a tag historian query via system.db.queryTagHistorian()… or at least prevent the system from bogging down if we perform too large of a query. Maybe it’s as simple as calculating the number of data points expected in the return and flagging the user if the return is too large? Or is there a more specific way to do this? I’ll include a _timeout_ parameter for now.

Also tried system.util.invokeAsynchronous and this didn’t seem to help.

```
data = system.tag.queryTagHistory(columnNames=columnNames,paths=paths,startDate=startTime, endDate=endTime2, returnSize=int(system.tag.read('DataReportSettings/sampleSize2').value),
	 aggregationMode=system.tag.read('DataReportSettings/aggregationMode').value, returnFormat='Wide')
```

---

<div class="post-metadata">

**Author:** ![mriederer](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@mriederer](https://forum.inductiveautomation.com/u/mriederer)\
**Post date:** [January 15, 2019, 2:12am UTC](https://forum.inductiveautomation.com/t/limiting-tag-historian-memory-usage/21880/2 "2019-01-15T02:12:10Z")

</div>

timeout doesn’t seem to be working… I set it to timeout = 2000 and it gets bogged down at about 5 seconds still.
