Hacker News new | ask | show | jobs
by munk-a 2690 days ago
Yes, and some people use prepared statements as one offs where a prepared statement will be registered and then some values will be sent to fulfill those "holes" and then we're done with the query, but prepared statements are reusable and pre-cacheable so it'd be interesting to know how communication from an application to a DBMS notes which statement it is talking about and what parts of the query plan a DBMS will reuse when re-executing the query.

It's quite interesting stuff, but because it's almost all details about the weeds a lot of abstract overviews of how DBMSes process queries skip over it as "implementation details" this particular article goes pretty deep into those details for regular queries so it'd be neat to see those details for prepared statements.

1 comments

Hi author here. I actually just learned this from you. https://www.postgresql.org/docs/9.6/sql-prepare.html will be my lunchtime reading. Thanks!
Yeah, parameter sniffing is also a concern and a thing you have to manage on the SQL Server side - it's led to probably the most venerable article on the topic in that community - http://www.sommarskog.se/query-plan-mysteries.html
Neato! If you investigate and find stuff I'd look forward to seeing your analysis, the work you did on standard statements is quite interesting.