From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Florian Pflug <fgp(at)phlo(dot)org> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: why do we need two snapshots per query? |
Date: | 2011-11-13 01:47:10 |
Message-ID: | CA+TgmoaOgJ_9OpKWx01jiG7ZDvf3xCpAkYTJdV-5uWkS4rSQdw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Nov 12, 2011 at 5:09 PM, Florian Pflug <fgp(at)phlo(dot)org> wrote:
> On Nov11, 2011, at 19:17 , Tom Lane wrote:
>> But frankly I do not like any of these proposals. Making fundamental
>> changes in long-established semantics in the name of squeezing out a few
>> cycles is the wrong way to design software.
>
> Hm, then maybe this is one of the things to put onto the next protocol
> version todo list?
+1. I had the same thought. It seems clear that we could design this
in a way that would make it clear to the server whether we wanted to
execute immediately or only upon further instructions, but trying to
guess the user's intentions seems a little too rich.
Meanwhile, here's my attempt at fixing this for the simple query
protocol. I'm attaching two patches:
- refactor-portal-start.patch, which attempts to change the API for
PortalStart() without any behavioral change whatsoever. The idea here
is that instead of passing a snapshot to PortalStart() explicitly, we
just pass a flag saying whether or not it's OK to use the active
snapshot (versus taking a new one). This seems to fit nicely with
existing calling patterns for this function.
- just-one-snapshot.patch, which applies atop
refactor-portal-start.patch, makes use of the new API to avoid the
need for PORTAL_ONE_SELECT queries to take two snapshots. It does so
by keeping the parse/analyze snapshot around just long enough to pass
it to PortalStart(). If PortalStart() chooses to register it, then it
(or a copy of it) will be around for a while longer; otherwise, it
will be dropped immediately after PortalStart() finishes.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment | Content-Type | Size |
---|---|---|
refactor-portal-start.patch | application/octet-stream | 4.1 KB |
just-one-snapshot.patch | application/octet-stream | 2.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2011-11-13 01:56:18 | Re: pg_restore --no-post-data and --post-data-only |
Previous Message | Thom Brown | 2011-11-13 00:58:18 | Re: FDW system columns |