On PostgreSQL 15.6 and TimescaleDB 2.14.2 self-host on prem time to time I see spike in queries times. I have analyzed one of the query and I see planning time is the cause of the problem.
In explain I see 8 seconds for planning and 35 mili-seconds for execution.
Details:
I have executed the following SQL:
https://justpaste.it/fmjqv
The following explain is returned:
https://justpaste.it/fcmjb
And table/index definition:
https://justpaste.it/dm2pq
Questions:
- How to reduce the SQL planning time?
- Is there some TimescaleDB parameter to set e.g. per session like IBM Db2 database has “query optimization class” with values between 0 and 9. Setting per session parameter for specific SQL to lower optimization and planning is drastically reduced.