Quantcast
Channel: TimescaleDB and PostgreSQL - Timescale Community Forum
Viewing all articles
Browse latest Browse all 294

How to reduce SQL planning time? Planning time 8 seconds, execution time 35 ms

$
0
0

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:

  1. How to reduce the SQL planning time?
  2. 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.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 294

Trending Articles