Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 3A3529F9931 for ; Fri, 24 Aug 2007 13:15:37 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 50668-03 for ; Fri, 24 Aug 2007 13:15:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 6AB249F9A3B for ; Fri, 24 Aug 2007 13:15:34 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l7OGFPlu001760; Fri, 24 Aug 2007 12:15:25 -0400 (EDT) To: "Steven Flatt" cc: "Mark Kirkwood" , "Gregory Stark" , "Bill Moran" , "Vivek Khera" , "Pgsql performance" Subject: Re: When/if to Reindex In-reply-to: <357fa7590708240722m204d678eid02b7ce3470eba1a@mail.gmail.com> References: <357fa7590707181008k65ab2f20l55bebb3c14f52770@mail.gmail.com> <357fa7590708081212p7b19cbbbn39dbadae8603edd6@mail.gmail.com> <20070808152757.9eb9bbcc.wmoran@collaborativefusion.com> <11801.1186624308@sss.pgh.pa.us> <357fa7590708090651p71b9bc47n66739f8dbbb4ff57@mail.gmail.com> <357fa7590708220955h441cd75ap4c0f0342a1c30a14@mail.gmail.com> <873aybw2le.fsf@oxford.xeocode.com> <357fa7590708231525h2f48ce4dw3e48ecca5ccddf72@mail.gmail.com> <17370.1187927942@sss.pgh.pa.us> <46CE6883.10104@paradise.net.nz> <357fa7590708240722m204d678eid02b7ce3470eba1a@mail.gmail.com> Comments: In-reply-to "Steven Flatt" message dated "Fri, 24 Aug 2007 10:22:38 -0400" Date: Fri, 24 Aug 2007 12:15:25 -0400 Message-ID: <1759.1187972125@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/286 X-Sequence-Number: 26416 "Steven Flatt" writes: >> The fly in the ointment is that after collecting the pg_index definition >> of the index, plancat.c also wants to know how big it is --- it calls >> RelationGetNumberOfBlocks. > Why do we even need to consider calling RelationGetNumberOfBlocks or looking > at the pg_class.relpages entry? My understanding of the expected behaviour > is that while a reindex is happening, all queries run against the parent > table are planned as though the index isn't there (i.e. it's unusable). Where in the world did you get that idea? If we had a REINDEX CONCURRENTLY it might work that way. A normal REINDEX cannot "mark" anything because it runs within a single transaction; there is no way that it can emit any catalog changes that will be visible before it's over. regards, tom lane