在 Postgres 14 中,为什么和pg_stat_statements
之间存在巨大的时差?max_exec_time
mean_exec_time
能否请你帮忙?
在 Postgres 14 中,为什么和pg_stat_statements
之间存在巨大的时差?max_exec_time
mean_exec_time
能否请你帮忙?
That means that the execution time varies considerably. To see if that is just a single outlier or a regular occurrence, see if stddev_exec_time
is high or not.
It can mean several things:
Perhaps execution sometimes took long because the statement was stuck behind a lock. If that is a rare occurrence, it may me the odd ALTER TABLE
statement.
Perhaps the execution time varies depending on a query parameter. It may be fast for rare values and slow for frequent ones. Test with different parameters!
Perhaps execution time varies depending on how much of the data happens to be cached in RAM. Look at a high "buffers" footprint in the EXPLAIN (ANALYZE, BUFFERS)
output.