Re: Repeated PredicateLockRelation calls during seqscan
От | Heikki Linnakangas |
---|---|
Тема | Re: Repeated PredicateLockRelation calls during seqscan |
Дата | |
Msg-id | 4E01B0B8.2020205@enterprisedb.com обсуждение исходный текст |
Ответ на | Repeated PredicateLockRelation calls during seqscan (Dan Ports <drkp@csail.mit.edu>) |
Ответы |
Re: Repeated PredicateLockRelation calls during seqscan
|
Список | 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 EnterpriseDB http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: