From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Dan Ports <drkp@csail.mit.edu>
Cc: pgsql-hackers@postgresql.org, Kevin Grittner <Kevin.Grittner@wicourts.gov>
Subject: Re: Repeated PredicateLockRelation calls during seqscan
Date: Wed, 22 Jun 2011 12:07:04 +0300
Message-ID: <4E01B0B8.2020205@enterprisedb.com> (raw)
In-Reply-To: <20110622045850.GN83336@csail.mit.edu>
References: <20110622045850.GN83336@csail.mit.edu>
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
EnterpriseDB http://www.enterprisedb.com
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: heikki.linnakangas@enterprisedb.com, drkp@csail.mit.edu, Kevin.Grittner@wicourts.gov
Subject: Re: Repeated PredicateLockRelation calls during seqscan
In-Reply-To: <4E01B0B8.2020205@enterprisedb.com>
* 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