X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 2C96ECCA74 for ; Thu, 17 Jul 2003 16:13:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 42496-07 for ; Thu, 17 Jul 2003 16:14:14 +0000 (GMT) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id E19C1CCA6A for ; Thu, 17 Jul 2003 13:13:43 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-32.mail.demon.net with esmtp (Exim 3.35 #1) id 19dBOV-000Cud-0W; Thu, 17 Jul 2003 17:14:11 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id A553616982; Thu, 17 Jul 2003 17:14:10 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 021401697C; Thu, 17 Jul 2003 17:14:09 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Bill Moran , pgsql-performance@postgresql.org Subject: Re: Relation of indices to ANALYZE Date: Thu, 17 Jul 2003 17:14:06 +0100 User-Agent: KMail/1.4.3 References: <3F16B68F.7060207@potentialtech.com> In-Reply-To: <3F16B68F.7060207@potentialtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307171714.06993.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/264 X-Sequence-Number: 2557 On Thursday 17 Jul 2003 3:45 pm, Bill Moran wrote: > Hello all, > > I'm putting together a database that has me wondering about the interacti= on > of ANALYZE with indices. I guess the basic question is: are indices > affected by the results of ANALYZE. > > The particular application I've got is doing a batch insert of lots of > records. For performance, I'm dropping the indexes on the table, doing t= he > inserts, then recreating the indexes a then doing a VACUUM ANALYZE.=20 > Specifically, I'm wondering if I should do the ANALYZE before or after I > recreate the indexes, or whether it matters. I don't think it matters - the analyse looks at the data, and then when you= =20 run a query the planner estimates how many rows each clause will require an= d=20 checks if there is an index that will help. --=20 Richard Huxton