# Deleting Historian Data

**URL:** <https://forum.inductiveautomation.com/t/deleting-historian-data/53550>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [November 29, 2021, 9:04pm UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550 "2021-11-29T21:04:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsalas](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jsalas](https://forum.inductiveautomation.com/u/jsalas)\
**Post date:** [November 29, 2021, 9:04pm UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/1 "2021-11-29T21:04:38Z")

</div>

On daylight savings we had some duplicate data being entered into the database from 1:00 - 1:59 am. I would like to delete some of that data which is being stored in the historian or find some other way of dealing with it. Has anyone else come across a similar issue?

---

<div class="post-metadata">

**Author:** ![brandon1](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@brandon1](https://forum.inductiveautomation.com/u/brandon1)\
**Post date:** [November 29, 2021, 9:12pm UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/2 "2021-11-29T21:12:47Z")

</div>

I’m confused. The Unix Timestamp that the Ignition Historian uses should avoid daylight savings time.

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [November 30, 2021, 4:56am UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/3 "2021-11-30T04:56:54Z")

</div>

The straight way, using DELETE queries.  
Can you confirm that, can you do a query that count duplicates time\_stamps?

---

<div class="post-metadata">

**Author:** ![SKA](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ska/32/29528_2.png) [@SKA](https://forum.inductiveautomation.com/u/SKA)\
**Post date:** [November 30, 2021, 7:46am UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/4 "2021-11-30T07:46:13Z")

</div>

> [@brandon1](#):
>
> I’m confused. The Unix Timestamp that the Ignition Historian uses should avoid daylight savings time.

Isnt the TS stored as miliseconds since a set date in like 1979's?  
This would in my mind not counter the daylight savings effect.

---

<div class="post-metadata">

**Author:** ![mpoulsen921](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@mpoulsen921](https://forum.inductiveautomation.com/u/mpoulsen921)\
**Post date:** [November 30, 2021, 10:23am UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/5 "2021-11-30T10:23:06Z")

</div>

The easiest way is to do it directly in the database.  
Just find the partition where the data is saved and delete the appropriate rows.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 30, 2021, 12:44pm UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/6 "2021-11-30T12:44:17Z")

</div>

> [@SKA](#):
>
> Isnt the TS stored as miliseconds since a set date in like 1979’s?  
> This would in my mind not counter the daylight savings effect.

It is the milliseconds since midnight Jan 1, 1970.

Time is linear, just because at 2am some places decide they're going to now call it 1am, doesn't actually change how many milliseconds have passed. There aren't 2 day's a year that have 25 hours.

> [@jsalas](#):
>
> On daylight savings we had some duplicate data being entered into the database from 1:00 - 1:59 am

Are you sure the data is actually duplicated? Or is it possible that when the t\_stamp is converted to a date the conversion is throwing things off?

---

<div class="post-metadata">

**Author:** ![jsalas](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jsalas](https://forum.inductiveautomation.com/u/jsalas)\
**Post date:** [November 30, 2021, 3:34pm UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/7 "2021-11-30T15:34:42Z")

</div>

I should clear something up, by duplicate data I initially meant data with the same time stamp - my mistake. The data itself is unique in that it was collected by the historian at the right time initially at 1 am and then again at 1 am after the time shifted back an hour. We decided to leave the data because it is still valid. And because we will lose an hour in the spring this ‘extra’ hour will be offset.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 30, 2021, 3:52pm UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/8 "2021-11-30T15:52:53Z")

</div>

So you’re saying this data has the exact same t\_stamp and tagid?

I find that very hard to believe as they are the index for the table, and there should have been a UNIQUE CONSTRAINT conflict error if Ignition (or anyone else for that matter) tried to insert duplicate records.

---

<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:** [November 30, 2021, 3:57pm UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/9 "2021-11-30T15:57:49Z")

</div>

The tag historian’s t\_stamp columns use milliseconds UTC. They will be monotonically increasing through the two hours in question.

---

<div class="post-metadata">

**Author:** ![jsalas](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jsalas](https://forum.inductiveautomation.com/u/jsalas)\
**Post date:** [November 30, 2021, 5:54pm UTC](https://forum.inductiveautomation.com/t/deleting-historian-data/53550/10 "2021-11-30T17:54:11Z")

</div>

So the time is the same when I format from unix time to a readable format. But the unix time itself is different.
