# Safe to drop data table from designer sql?

**URL:** <https://forum.inductiveautomation.com/t/safe-to-drop-data-table-from-designer-sql/72669>\
**Category:** Ignition\
**Tags:** database, ignition81, perspective\
**Created:** [April 19, 2023, 8:11pm UTC](https://forum.inductiveautomation.com/t/safe-to-drop-data-table-from-designer-sql/72669 "2023-04-19T20:11:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shawn\_Rieger](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger/32/46336_2.png) [@Shawn\_Rieger](https://forum.inductiveautomation.com/u/Shawn_Rieger)\
**Post date:** [April 19, 2023, 8:11pm UTC](https://forum.inductiveautomation.com/t/safe-to-drop-data-table-from-designer-sql/72669/1 "2023-04-19T20:11:16Z")

</div>

I need to clear up some space on our production database. Currently, even HMIs that are in development store tag history in the production DB.

I'd like to clear out some old tables from one of our sites. I understand the table naming convention using the DRV ID as the first number, followed by year and month.

If I simply drop the oldest table with the matching DRV ID, will this have any effect on the system or perspective app? Is there anything else I would need to do or watch out for? Also, can this be done directly from the DB Query Browser in the designer?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 19, 2023, 8:14pm UTC](https://forum.inductiveautomation.com/t/safe-to-drop-data-table-from-designer-sql/72669/2 "2023-04-19T20:14:08Z")

</div>

Can you do this with the built-in historian data pruning?  
[https://docs.inductiveautomation.com/display/DOC80/Tag+History+Gateway+Settings](https://docs.inductiveautomation.com/display/DOC80/Tag+History+Gateway+Settings)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 19, 2023, 8:27pm UTC](https://forum.inductiveautomation.com/t/safe-to-drop-data-table-from-designer-sql/72669/3 "2023-04-19T20:27:17Z")

</div>

You'll want to drop the record from `sqlth_partitions` that says "there's data for this time range in X table" at the same time you drop an actual `sqlt_data_X_Y` table. Which is what pruning would do for you, but you certainly can do it manually, as well.

---

<div class="post-metadata">

**Author:** ![Shawn\_Rieger](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger/32/46336_2.png) [@Shawn\_Rieger](https://forum.inductiveautomation.com/u/Shawn_Rieger)\
**Post date:** [April 19, 2023, 9:58pm UTC](https://forum.inductiveautomation.com/t/safe-to-drop-data-table-from-designer-sql/72669/4 "2023-04-19T21:58:11Z")

</div>

Thanks!

Regarding pruning. If I enabled this, wouldn't it remove tables that match the criteria across drivers? I only want to remove old data from one or two specific drivers.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 19, 2023, 10:26pm UTC](https://forum.inductiveautomation.com/t/safe-to-drop-data-table-from-designer-sql/72669/5 "2023-04-19T22:26:22Z")

</div>

Pruning doesn't know anything about drivers. All it knows is the history provider name (the database) and the pruning settings. The default is that history is broken into monthly files and pruning is done after so many months. There is no built-in way to delete historical data by OPC device name or path.
