# Reduce the density of old history data

**URL:** <https://forum.inductiveautomation.com/t/reduce-the-density-of-old-history-data/60732>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [June 14, 2022, 6:02am UTC](https://forum.inductiveautomation.com/t/reduce-the-density-of-old-history-data/60732 "2022-06-14T06:02:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nideyijuyidong](https://avatars.discourse-cdn.com/v4/letter/n/7cd45c/32.png) [@nideyijuyidong](https://forum.inductiveautomation.com/u/nideyijuyidong)\
**Post date:** [June 14, 2022, 6:02am UTC](https://forum.inductiveautomation.com/t/reduce-the-density-of-old-history-data/60732/1 "2022-06-14T06:02:51Z")

</div>

Is there any way to reduce the density of historical data？I mean, I saved per second, and it’s unnessessary for more then two years old data. But I don’t want loss all old data. Is there any way to reduce the rate to 1 minute for old data?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 14, 2022, 11:25am UTC](https://forum.inductiveautomation.com/t/reduce-the-density-of-old-history-data/60732/2 "2022-06-14T11:25:48Z")

</div>

I’m thinking something like

```nohighlight
delete from sqlt_data_X_YYYY_MM where extract(second from from_unixtime(t_stamp/1000)) / 10 != 0

```

There might be a better/cleaner syntax, but hey… This should delete all entries where the seconds are not between 00 and 09.  
You can use the `sqlth_partitions` table to find all the historian data tables.

edit: Oh wait, you’re historizing every second… then

```nohighlight
delete from sqlt_data_X_YYYY_MM where extract(second from from_unixtime(t_stamp/1000)) != 0

```

Would delete every entry where seconds are not 0.

Use at your own risks 😃

---

<div class="post-metadata">

**Author:** ![nideyijuyidong](https://avatars.discourse-cdn.com/v4/letter/n/7cd45c/32.png) [@nideyijuyidong](https://forum.inductiveautomation.com/u/nideyijuyidong)\
**Post date:** [June 14, 2022, 1:12pm UTC](https://forum.inductiveautomation.com/t/reduce-the-density-of-old-history-data/60732/3 "2022-06-14T13:12:19Z")

</div>

Haha，It’s worth trying. I’m just worried about whether the ignition will recognize the rest data.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 14, 2022, 1:15pm UTC](https://forum.inductiveautomation.com/t/reduce-the-density-of-old-history-data/60732/4 "2022-06-14T13:15:00Z")

</div>

What do you mean, the rest data ?  
You’re afraid the remaining data will be corrupted ?  
It won’t. Each row in those tables represent an individual data point, removing one shouldn’t break the others.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [June 14, 2022, 2:59pm UTC](https://forum.inductiveautomation.com/t/reduce-the-density-of-old-history-data/60732/5 "2022-06-14T14:59:16Z")

</div>

ive deleted individual entries many times with no issue.
