3 ms·
(The article goes a bit above my head so my excuses if I am a bit off-topic) There is a form of query plan caching in PG: for prepared statements, if PG determ
by williamdclt 3y ago
(The article goes a bit above my head so my excuses if I am a bit off-topic)
There is a form of query plan caching in PG: for prepared statements, if PG determines that the actual value of parameters won't affect the query plan much, it uses a "generic plan" so that it reuses the same query plan for every execution of the prepared statement (https://www.postgresql.org/docs/current/sql-prepare.html https://www.postgresql.org/docs/current/sql-prepare.html, see "notes")
- pinaraf 3y agoIndeed, and right now it's the only possible way since it remains in a single session, doing otherwise would be very hard.
- cbsmith 3y agoUnless you count stored procs...
- SigmundA 3y agoYes its manual and per session, DB's like MSSQL have that was well but are very rarely used anymore because it got automatic plan caching about 20 years ago which basically eliminates any advantage to manually preparing. Its actually better since it can be shared across all sessions