pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dan Ports <drkp@csail.mit.edu>
To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Cc: pgsql-hackers@postgresql.org, Kevin Grittner <Kevin.Grittner@wicourts.gov>
Subject: Re: Repeated PredicateLockRelation calls during seqscan
Date: Wed, 22 Jun 2011 17:29:50 -0400
Message-ID: <20110622212950.GR83336@csail.mit.edu> (raw)
In-Reply-To: <4E01B0B8.2020205@enterprisedb.com>
References: <20110622045850.GN83336@csail.mit.edu>
	<4E01B0B8.2020205@enterprisedb.com>

On Wed, Jun 22, 2011 at 12:07:04PM +0300, Heikki Linnakangas wrote:
> Hmm, I wonder if we should move this logic to heapam.c. The optimization 
> to acquire a relation lock straight away should apply to all heap scans, 
> not only those coming from ExecSeqScan. The distinction is academic at 
> the moment, because that's the only caller that uses a regular MVCC 
> snapshot, but it seems like a modularity violation for nodeSeqscan.c to 
> reach into the HeapScanDesc to set the flag and grab the whole-relation 
> lock, while heapam.c contains the PredicateLockTuple and 
> CheckForSerializableConflictOut() calls.

On modularity grounds, I think that's a good idea. The other
PredicateLock* calls live in the access methods: heapam, nbtree, and
indexam for the generic index support. heap_beginscan_internal seems
like a reasonable place, as long as we're OK with taking the lock even
if the scan is initialized but never called.

Note that this hadn't been a reasonable option until last week when we
added the check for non-MVCC snapshots, since there are lots of things
that use heap scans but SeqScan is the only (currently-existing) one we
want to lock.

I am rather uneasy about making changes here unless we can be
absolutely certain they're right...

Dan

-- 
Dan R. K. Ports              MIT CSAIL                http://drkp.net/



view thread (13+ messages)  latest in thread

Message-ID: <20110622212950.GR83336@csail.mit.edu>
Permalink:  ../20110622212950.GR83336@csail.mit.edu/
Also on:    postgresql.org/message-id/20110622212950.GR83336@csail.mit.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: drkp@csail.mit.edu, heikki.linnakangas@enterprisedb.com, Kevin.Grittner@wicourts.gov
  Subject: Re: Repeated PredicateLockRelation calls during seqscan
  In-Reply-To: <20110622212950.GR83336@csail.mit.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox