Re: bind variables, soft vs hard parse

From: Marcus Engene <mengpg(at)engene(dot)se>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: bind variables, soft vs hard parse
Date: 2005-11-16 08:56:44
Message-ID: 437AF44C.1010209@engene.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Grzegorz Jaskiewicz 2005-11-16 09:05:36 question about count(b) where b is a custom type
Previous Message Martijn van Oosterhout 2005-11-16 08:47:33 Re: PG_DUMP and table locking in PG7.4