On Mon, May 7, 2018 at 2:32 PM, Pavel Stehule <pavel.steh...@gmail.com> wrote: > For interactive application only for one subset of queries the plan cache is > interesting. > > @1 There are long queries - the planning time is not significant (although > can be high), and then plan cache is not important > @2 there are fast queries with fast planning time - usually we don't need > plan cache too > @3 there are fast queries with long planning time - and then plan cache is > very interesting - can be difficult to separate this case from @1.
That's not my experience. I agree that plan caching isn't important for long-running queries, but I think it *is* potentially important for fast queries with fast planning time. Even when the planning time is fast, it can be a significant percentage of the execution time. Not long ago, we had a case at EDB where a customer was getting custom plans instead of generic plans and that resulted in a significant reduction in TPS. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company