Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UzpHj-0006J5-Gf for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jul 2013 14:34:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UzpHi-0006Gw-Eg for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jul 2013 14:34:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UzpHf-0006C7-1r; Thu, 18 Jul 2013 14:34:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UzpHc-00067Y-9w; Thu, 18 Jul 2013 14:34:18 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r6IEYEPQ003462; Thu, 18 Jul 2013 10:34:15 -0400 (EDT) From: Tom Lane To: Robert Haas cc: pgsql-hackers@postgresql.org, pgsql-odbc@postgresql.org Subject: Re: [ODBC] getting rid of SnapshotNow In-reply-to: References: Comments: In-reply-to Robert Haas message dated "Thu, 18 Jul 2013 08:46:48 -0400" Date: Thu, 18 Jul 2013 10:34:14 -0400 Message-ID: <3461.1374158054@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > 1. snapshot-error-v1.patch introduces a new special snapshot, called > SnapshotError. In the cases where we set SnapshotNow as a sort of > default snapshot, this patch changes the code to use SnapshotError > instead. This affects scan->xs_snapshot in genam.c and > estate->es_snapshot in execUtils.c. This passes make check-world, so > apparently there is no code in the core distribution that does this. > However, this is safer for third-party code, which will ERROR instead > of seg faulting. The alternative approach would be to use > InvalidSnapshot, which I think would be OK too if people dislike this > approach. FWIW, I think using InvalidSnapshot would be preferable to introducing a new concept for what's pretty much the same thing. > With that done, the only remaining uses of SnapshotNow in our code > base will be in currtid_byreloid() and currtid_byrelname(). So far no > one on this list has been able to understand clearly what the purpose > of those functions is, so I'm copying this email to pgsql-odbc in case > someone there can provide more insight. I had the idea they were used for a client-side implementation of WHERE CURRENT OF. Perhaps that's dead code and could be removed entirely? > If we don't want to risk any change to the semantics, we can (1) grit > our teeth and keep SnapshotNow around or (2) use an instantaneous MVCC > snapshot there, and accept that people who have very large connection > counts and extremely heavy use of those functions may see a > performance regression. Of those I'd go for (2); it's unlikely that an extra snapshot would be visible compared to the query roundtrip overhead. But another attractive possibility is to make these functions use GetActiveSnapshot(), which would avoid taking any new snapshot. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers