Prepared statements (either explicitly prepared or implicitly generated, for example by PL/pgSQL) can be executed using custom or generic plans. Custom plans are made afresh for each execution using its specific set of parameter values, while generic plans do not rely on the parameter values and can be re-used across executions. Thus, use of a generic plan saves planning time, but if the ideal plan depends strongly on the parameter values then a generic plan may be inefficient. The choice between these options is normally made automatically, but it can be overridden with
plan_cache_mode. The allowed values are
auto (the default),
force_generic_plan. This setting is considered when a cached plan is to be executed, not when it is prepared. For more information see sql-prepare.
- Java Hibernate insert hypertable in timescaledb is very slow
- Why does "explain analyzing" this query fnish fast (showing a parallel plan), while running the actual query without "explain analyze" doesn't?
- PostgreSQL 13 sometimes works but sometimes huge execution time
- Error: self signed certificate when doing a migration to production