I am testing an PostgreSQL extension named Timescaledb for time series data. If I read the document of PostgreSQL right, the query for example
WHERE x = 'somestring' and timestamp between 't1' and 't2'
will work best with index (x,timestamp)
. And run EXPLAIN
on that SQL query shows that it works.
When I try the same query on Timescaledb hypertable, which contains same data and without index (x,timestamp)
. The performance is about the same (if not better). After creating index (x,timestamp)
, the performance does not improve.
I understand that the hypertable have a build-in timestamp index. So, I should have a different strategy to add index to the table, for example index with just (x)
. Is that right?