Douglas McNaught wrote:
>>Which will be the same as the second call. There is quite a big
>>difference in performance using bind variables.
>>
>>Does Postgres work the same? Where can I go for more info?
>
> You can do this (or close to it) but you need to explicitly PREPARE
> the query (or use the protocol-level prepare, which some client
> libraries will do for you). See the SQL documentation for PREPARE.
>
> -Doug
Hi,
But this is of no use in a web-context. According to the docs, this
prepare is per session.
This sql cache I think is a really good thing. Is there a reason
Postgres hasn't got it? Would it be very hard to implement? From
a naive perspective; make a hashvalue from the sql-string to
quickly find the cached one, a "last used"-list for keeping
track of which to delete when cache full etc seems close to
trivial. Does the architecture/internal flow make it hard
actually reuse the query data structure?
Thanks for the answer.
Best regards,
Marcus