4 ms·
PostgreSQL doesn't even cache its own byte code, it replans every time!
by SigmundA 5y ago
PostgreSQL doesn't even cache its own byte code, it replans every time!
- mst 5y agoDepending on the placeholder values the optimal plan may be very different. You -can- use a server side prepared statement to force it to -ahem- plan ahead but that's -usually- not actually worth it.
- SigmundA 5y agoThats why other databases have parameter sniffing. And using prepared statements only works on the same connection so of limited use. Luckily PostgreSQL's optimizer is very primitive and so planning doesn't take too much time, as it gets more advanced the lack of plan reuse will become more of an issue. Its already an issue with the LLVM JIT compilation time.