Skip site navigation (1) Skip section navigation (2)

Re: Repeated PredicateLockRelation calls during seqscan

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Dan Ports <drkp(at)csail(dot)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Subject: Re: Repeated PredicateLockRelation calls during seqscan
Date: 2011-06-22 09:07:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On 22.06.2011 07:58, Dan Ports wrote:
> I was looking at ExecSeqScan today and noticed that it invokes
> PredicateLockRelation each time it's called, i.e. for each tuple
> returned. Any reason we shouldn't skip that call if
> rs_relpredicatelocked is already set, as in the attached patch?
> That would save us a bit of overhead, since checking that flag is
> cheaper than doing a hash lookup in the local predicate lock table
> before bailing out.

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.

BTW, isn't bitgetpage() in nodeBitmapHeapscan.c missing 
PredicateLockTuple() and CheckForSerializableConflictOut() calls in the 
codepath for a lossy bitmap? In the non-lossy case, 
heap_hot_search_buffer() takes care of it, but not in the lossy case.

   Heikki Linnakangas

In response to


pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2011-06-22 09:25:53
Subject: Re: Coding style point: "const" in function parameter declarations
Previous:From: Heikki LinnakangasDate: 2011-06-22 06:58:02
Subject: Re: Coding style point: "const" in function parameter declarations

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group