# Creating specific start and stop time historical partition

**URL:** <https://forum.inductiveautomation.com/t/creating-specific-start-and-stop-time-historical-partition/47572>\
**Category:** Module Development\
**Tags:** ignition81\
**Created:** [June 8, 2021, 6:09pm UTC](https://forum.inductiveautomation.com/t/creating-specific-start-and-stop-time-historical-partition/47572 "2021-06-08T18:09:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom.prodehl](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tom.prodehl/32/22713_2.png) [@tom.prodehl](https://forum.inductiveautomation.com/u/tom.prodehl)\
**Post date:** [June 8, 2021, 6:09pm UTC](https://forum.inductiveautomation.com/t/creating-specific-start-and-stop-time-historical-partition/47572/1 "2021-06-08T18:09:49Z")

</div>

In my module I analyze processes as they happen with specific start and stop times. Is it possible using the Java sdk to create a new partition either at the start time or at the end time to hold the data only for the process being analyzed? Fully usable partitions that can be queried across if desired.

---

<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:** [June 8, 2021, 6:44pm UTC](https://forum.inductiveautomation.com/t/creating-specific-start-and-stop-time-historical-partition/47572/2 "2021-06-08T18:44:38Z")

</div>

I don’t think so, no. You could maybe try manually creating partitions and associated records in the `sqlth_partitions` table, but it’s somewhat ‘dangerous’.

---

<div class="post-metadata">

**Author:** ![tom.prodehl](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tom.prodehl/32/22713_2.png) [@tom.prodehl](https://forum.inductiveautomation.com/u/tom.prodehl)\
**Post date:** [June 8, 2021, 7:14pm UTC](https://forum.inductiveautomation.com/t/creating-specific-start-and-stop-time-historical-partition/47572/3 "2021-06-08T19:14:08Z")

</div>

“I don’t think so” is vague. Can you be less so? I see that there is info in SDK for partition creation, is usage by mortals not granted? Define “somewhat ‘dangerous’”. Causes mysterious operation, is unsupported, or what.

---

<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:** [June 8, 2021, 7:30pm UTC](https://forum.inductiveautomation.com/t/creating-specific-start-and-stop-time-historical-partition/47572/4 "2021-06-08T19:30:09Z")

</div>

No, you don’t have access to the internal tag historian classes that drive the creation of partitions.  
You can certainly _try_ creating partitions manually - but it’s not something we test against, or something we’re obliged to support. I don’t know, for sure, whether it would work - I’m inclined to think it probably would, but I don’t know, for instance, what happens if you define two partitions in `sqlth_partitions` that cover the same timespan for the same provider. ‘Undefined behavior’ is generally not a thing you want when we’re talking about stored process data.

---

<div class="post-metadata">

**Author:** ![WillMT10](https://avatars.discourse-cdn.com/v4/letter/w/7feea3/32.png) [@WillMT10](https://forum.inductiveautomation.com/u/WillMT10)\
**Post date:** [June 9, 2021, 3:10am UTC](https://forum.inductiveautomation.com/t/creating-specific-start-and-stop-time-historical-partition/47572/5 "2021-06-09T03:10:03Z")

</div>

If you want to play around with partitions, you could leave the automatic partitions untouched and, in a second schema, create the partitions you’re looking for and copy over the relevant data from the automatic partitions. You could create manipulated `sqlth` tables in this second schema to match your partitions. This will make sure that you don’t mangle your automatic partitions. Just be wary of how you copy over the data, depending on the amount of data, you could lock up your DB history tables for quite a while.
