Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 25927B5DBC1 for ; Wed, 22 Jun 2011 15:19:58 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 32841-10 for ; Wed, 22 Jun 2011 18:19:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og109.obsmtp.com (exprod7og109.obsmtp.com [64.18.2.171]) by mail.postgresql.org (Postfix) with ESMTP id 1BF21B5DBC5 for ; Wed, 22 Jun 2011 15:19:50 -0300 (ADT) Received: from mail-ey0-f171.google.com ([209.85.215.171]) (using TLSv1) by exprod7ob109.postini.com ([64.18.6.12]) with SMTP ID DSNKTgIyRY1CtIWxW2Npm4mflkIcXL5V/p8K@postini.com; Wed, 22 Jun 2011 11:19:51 PDT Received: by eydd26 with SMTP id d26so488678eyd.16 for ; Wed, 22 Jun 2011 11:19:48 -0700 (PDT) Received: by 10.14.148.130 with SMTP id v2mr775123eej.249.1308766788412; Wed, 22 Jun 2011 11:19:48 -0700 (PDT) Received: from [90.190.247.247] (247.247.190.90.dyn.estpak.ee [90.190.247.247]) by mx.google.com with ESMTPS id b19sm668467eec.8.2011.06.22.11.19.45 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Jun 2011 11:19:46 -0700 (PDT) Message-ID: <4E023240.6070100@enterprisedb.com> Date: Wed, 22 Jun 2011 21:19:44 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.2.17) Gecko/20110606 Icedove/3.1.10 MIME-Version: 1.0 To: Tom Lane CC: Dan Ports , pgsql-hackers@postgresql.org, Kevin Grittner Subject: Re: Repeated PredicateLockRelation calls during seqscan References: <20110622045850.GN83336@csail.mit.edu> <29470.1308752899@sss.pgh.pa.us> In-Reply-To: <29470.1308752899@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/1902 X-Sequence-Number: 190615 On 22.06.2011 17:28, Tom Lane wrote: > Dan Ports writes: >> 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? > > Why is the call in ExecSeqScan at all, and not in the node startup > function? It makes sense to delay it until the scan is actually started, so that you don't get unnecessary serialization failures if the scan is never actually executed. I don't know if that was Kevin's original reason for putting it there, but that's why I left it there. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com