Re: Parameterized prepared statements

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Parameterized prepared statements
Date: 2011-09-04 15:09:22
Message-ID: CAAfz9KME5rCjWc4TgGns=87PJgh9t0p8bpcs4Gwf0rrR6j0uzw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey Craig,

Things like pre-parsed prepared statements that're re-planned on every
> execution are often proposed as solutions to this. This has me wondering:
> rather than expensively re-planning from scratch, would it be possiblet to
> adjust the planning process so that *multiple* alternative plans would be
> cached for a query, using placeholders for unknown rowcounts and costs? At
> execution, the unknown costs would be filled in and the plans compared then
> the best plan picked for this execution. Is this crazy talk, or could it
> significantly reduce the cost of re-planning parameterized prepared
> statements to the point where it'd be worth doing by default?
>
Its a good suggestion of some kind of optimization at the server side.
This idea can be extended to an "auto-prepare" mode (like an auto-commit
mode that we have today in Postgres).
But its not so hard to let the application (or library) to decide what to
use in
different cases: prepared statement or regular statement. Thus, I think it
is
not worth it...

--
> Craig Ringer
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-general<http://www.postgresql.org/mailpref/pgsql-general>
>

--
// Dmitriy.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2011-09-04 15:25:20 Re: CentOS 6 - www.pgrpms.org - SELinuxi dn
Previous Message Martijn van Oosterhout 2011-09-04 10:03:53 Re: Parameterized prepared statements