# Pre-Creating Historical Partitions

**URL:** <https://forum.inductiveautomation.com/t/pre-creating-historical-partitions/3675>\
**Category:** Ignition\
**Created:** [November 30, 2011, 7:18pm UTC](https://forum.inductiveautomation.com/t/pre-creating-historical-partitions/3675 "2011-11-30T19:18:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jconnor34](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@jconnor34](https://forum.inductiveautomation.com/u/jconnor34)\
**Post date:** [November 30, 2011, 7:18pm UTC](https://forum.inductiveautomation.com/t/pre-creating-historical-partitions/3675/1 "2011-11-30T19:18:13Z")

</div>

If a historical partition exists before Ignition creates it, will that cause any problems with Ignition? For example, if I want to create a partition for January 2012 would Ignition start using that partition when Jan came around or would it make it’s own partition?

I am making reports that directly get data from the monthly partitions and do some aggregation. Some of the reports require looking at a years worth of partitions at a time and if that partition doesn’t exist the SQL Query throws an error.

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [December 1, 2011, 12:28am UTC](https://forum.inductiveautomation.com/t/pre-creating-historical-partitions/3675/2 "2011-12-01T00:28:14Z")

</div>

You can pre-create them. When the system goes to store data, it queries the sqlth\_partition table for a table that covers the required time. If found, it verifies that the table is “valid”, meaning that it covers the range expected. However, if you’re using monthly partitions, it actually just looks at the table name. So, if you make sure to name the tables correctly, and make sure to insert the correct values into sqlth\_partitions, you should be fine. In regards to inserting records, you can use something like: `insert into sqlth_partitions(pname,drvid,start_time,end_time) values('sqlt_data_1_2011_12',1, unix_timestamp('2011-12-01 00:00:00')*1000,unix_timestamp('2011-12-31 23:59:59')*1000)`

Regards,

---

<div class="post-metadata">

**Author:** ![Alex\_Race](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alex_race/32/44583_2.png) [@Alex\_Race](https://forum.inductiveautomation.com/u/Alex_Race)\
**Post date:** [March 8, 2023, 1:35pm UTC](https://forum.inductiveautomation.com/t/pre-creating-historical-partitions/3675/3 "2023-03-08T13:35:27Z")

</div>

There is a question, I have set the Data Partitioning 2 Months, and the table sqlth\_partitions's record is **pname** : sqlt\_data\_1\_20230308  
**start\_time** : 2023-03-08 21:08:38.000  
**end\_time** : 2023-05-07 21:08:38.000

And reset the Data Partitioning to 2 Days, but after 2 days, there is no changes in table sqlth\_partitions, is that a bug?

---

<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:** [March 8, 2023, 10:01pm UTC](https://forum.inductiveautomation.com/t/pre-creating-historical-partitions/3675/4 "2023-03-08T22:01:20Z")

</div>

Known and not great behavior, but not officially a bug. Your new partitioning will start on May 7th, IIRC.
