X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8595FD7EB2 for ; Sat, 27 Aug 2005 03:34:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45167-06 for ; Sat, 27 Aug 2005 06:34:24 +0000 (GMT) Received: from mail.travelamericas.com (unknown [206.130.134.147]) by svr1.postgresql.org (Postfix) with SMTP id 69056D7ED8 for ; Sat, 27 Aug 2005 03:34:22 -0300 (ADT) Received: (qmail 12882 invoked from network); 27 Aug 2005 06:34:23 -0000 Received: from unknown (HELO ?10.0.0.253?) (10.0.0.253) by verkiel.travelamericas.com with SMTP; 27 Aug 2005 06:34:23 -0000 Message-ID: <4310096F.3020805@metatrontech.com> Date: Fri, 26 Aug 2005 23:34:23 -0700 From: Chris Travers User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Lenard, Rohan (Rohan)" Cc: pgsql-performance@postgresql.org Subject: Re: Need indexes on empty tables for good performance ? References: <2773CAC687FD5F4689F526998C7E4E5F43F392@au3010avexu1.global.avaya.com> In-Reply-To: <2773CAC687FD5F4689F526998C7E4E5F43F392@au3010avexu1.global.avaya.com> Content-Type: multipart/mixed; boundary="------------060901010708010604050506" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 required=5 tests=[AWL=-0.000, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200508/519 X-Sequence-Number: 14266 This is a multi-part message in MIME format. --------------060901010708010604050506 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Lenard, Rohan (Rohan) wrote: > I've read that indexes aren't used for COUNT(*) and I've noticed > (7.3.x) with EXPLAIN that indexes never seem to be used on empty > tables - is there any reason to have indexes on empty tables, or will > postgresql never use them. You could add a row, vacuum analyze, delete the row, etc.... Then you are fine until you vacuum analyze again ;-) This is a feature designed to prevent really bad plans when you are loading tables with data. However, you are right. It can create bad plans sometimes. Any chance one can eventually come up with a way to tell the planner that an empty table is expected not to grow? Otherwise, I can see nightmares in a data warehouse environment where you have an empty parent table... Best Wishes, Chris Travers Metatron Technology Consulting --------------060901010708010604050506 Content-Type: text/x-vcard; charset=utf-8; name="chris.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="chris.vcf" begin:vcard fn:Chris Travers n:Travers;Chris email;internet:chris@metatrontech.com x-mozilla-html:FALSE version:2.1 end:vcard --------------060901010708010604050506--