4 ms·
PostgreSQL is probably smarter than SQLite. :) Anyway, at minimum you have prepared statements where a given plan may be great for one execution and terrible f
by ncruces 1y ago
PostgreSQL is probably smarter than SQLite. :)
Anyway, at minimum you have prepared statements where a given plan may be great for one execution and terrible for the next. Maybe the database re-prepares for you, and then it's the same as a dynamic query.
- atombender 1y agoPostgres is smarter about that, too! It evaluates whether the prepared statement is sensitive to parameter changes, and will either use a "generic" plan that's shared across all invocations, or a custom one that is hardwired to the values. There's a setting that controls the behaviour. https://www.postgresql.org/docs/current/sql-prepare.html https://www.postgresql.org/docs/current/sql-prepare.html I've not compared the actual behaviour in the codebases I work on, however.