Re: why do we need two snapshots per query?
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Florian Pflug <fgp@phlo.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org
Date: 2011-11-13T01:47:10Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix copyright notices, other minor editing in new range-types code.
- f1585362856d 9.2.0 cited
-
Redesign the plancache mechanism for more flexibility and efficiency.
- e6faf910d750 9.2.0 cited
Attachments
- refactor-portal-start.patch (application/octet-stream) patch
- just-one-snapshot.patch (application/octet-stream) patch
On Sat, Nov 12, 2011 at 5:09 PM, Florian Pflug <fgp@phlo.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