Postgres version: PostgreSQL 15.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
TimscaleDB version: 2.12.1
Hypertable is compressed.
If the query joins compressed hypertable with regular postgres table and period is larger then few days then exception is threw
SELECT date_trunc('day', a.date_col) AS col_date,
a.col2,
b.col3,
COUNT(DISTINCT a.id_account),
SUM(a.num_col1 - a.num_col2)
FROM compressed_hypert AS a
INNER JOIN postgres_table AS b ON b.id = a.id
WHERE a.col_date >= TIMESTAMP '2023-10-01' AND a.col_date < TIMESTAMP '2023-11-15'
GROUP BY date_trunc('day', a.date_col), a.col2, b.col3
;
SQL Error [XX000]: ERROR: could not find pathkey item to sort
If I reduce period to few days then the query gives the result successfully.
About this I found issue on github but the decision I did not find.
Is there a workaround to do the query like above working?
For me, GROUP BY SMALLINT type columns didn’t work.
Casting to ::INTEGER fixed it.
have you checked the types compatibility?
It seems a very old chunk, probably If you’re able to put it into a minimal reproducible example it will simply work. If you try let us know, at least we can understand if something was left behind and it’s a migration pitfall rather than a feature error