# Historical Data Issue

**URL:** <https://forum.inductiveautomation.com/t/historical-data-issue/102934>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 26, 2025, 8:29pm UTC](https://forum.inductiveautomation.com/t/historical-data-issue/102934 "2025-02-26T20:29:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tebright1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tebright1/32/87405_2.png) [@tebright1](https://forum.inductiveautomation.com/u/tebright1)\
**Post date:** [February 26, 2025, 8:29pm UTC](https://forum.inductiveautomation.com/t/historical-data-issue/102934/1 "2025-02-26T20:29:29Z")

</div>

I have a bunch of historical tags we are pulling data from. Running into a strange issue.

I generate a custom to pull data from my database.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/8/b8207a13eb7be14e65f9b7bfbfd687dc2fed98dc.png)

```
dataset = system.tag.queryTagHistory(paths=tagListCorrected, startDate=startTime, endDate=endTime, returnSize=size, aggregationMode="LastValue", returnFormat='Wide', timeout=60000)

```

When I look at my Historical Data using a trend object I can see the data. This is using

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

When I look at an hour of data.

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

When I pull a larger range the data shows up.

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

Any thoughts? The value didn't change for several days. Its like my queryTagHistory is spitting out a 0 when a tag doesn't change for a bit.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 26, 2025, 8:38pm UTC](https://forum.inductiveautomation.com/t/historical-data-issue/102934/2 "2025-02-26T20:38:36Z")

</div>

Make sure you have a Max Time between samples set. See: [Configuring Tag History | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/tag-historian/configuring-tag-history#max-and-min-time-between-samples)

Set the Max Time to some value smaller than the smallest window you will query. If the smallest that you are looking for is an hour, then set it for 50 min.

---

<div class="post-metadata">

**Author:** ![tebright1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tebright1/32/87405_2.png) [@tebright1](https://forum.inductiveautomation.com/u/tebright1)\
**Post date:** [February 26, 2025, 8:49pm UTC](https://forum.inductiveautomation.com/t/historical-data-issue/102934/3 "2025-02-26T20:49:19Z")

</div>

What I have it set to (default). Will try your suggestion. Thanks.

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

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 26, 2025, 8:53pm UTC](https://forum.inductiveautomation.com/t/historical-data-issue/102934/4 "2025-02-26T20:53:38Z")

</div>

With a 0 in Max Time Between Samples you will have this as per the manual: "By default, an "unlimited" amount of time can pass between records – if the value doesn't change, a new row is never inserted in the database"

Do note, this _will_ increase your database usage. However, if just a couple of tags not but a noticeable amount. So there is a balance between database storage and usability at the end of the day.

---

<div class="post-metadata">

**Author:** ![tebright1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tebright1/32/87405_2.png) [@tebright1](https://forum.inductiveautomation.com/u/tebright1)\
**Post date:** [February 26, 2025, 9:01pm UTC](https://forum.inductiveautomation.com/t/historical-data-issue/102934/5 "2025-02-26T21:01:10Z")

</div>

I think this helped. Will check back after an hour.

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

Storage won't be an issue. This is for a company that will be providing data for 10+ years. So where it is being stored is really large.
