# Problematic Historian Query with TimescaleDB

**URL:** <https://forum.inductiveautomation.com/t/problematic-historian-query-with-timescaledb/68760>\
**Category:** Ignition\
**Created:** [January 18, 2023, 10:10pm UTC](https://forum.inductiveautomation.com/t/problematic-historian-query-with-timescaledb/68760 "2023-01-18T22:10:35Z")\
**Posts on this page:** 1\
**Showing post:** 8

<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:** [May 7, 2025, 6:17pm UTC](https://forum.inductiveautomation.com/t/problematic-historian-query-with-timescaledb/68760/8 "2025-05-07T18:17:03Z")

</div>

> [@cody.tamaki](#):
>
> but when using TimescaleDB (which only looks like a single partition) this query will end up scanning all rows for each tag id for the entire history of the database.

I believe it should skip the hypertable's partitions that don't match the where clause and start with the first one that has a time range above the timestamp passed as parameter, and find the first record where the tagid matches, then return.  
From the query browser, it looks like one giant table, but it does have partitions. Assuming things were setup properly.

---

_[View the full topic](https://forum.inductiveautomation.com/t/problematic-historian-query-with-timescaledb/68760)._
