Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 2B2E89FB6D3 for ; Mon, 23 Apr 2007 11:56:51 -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 58271-01-2 for ; Mon, 23 Apr 2007 11:56:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from globalrelay.com (mail1.globalrelay.com [204.92.49.200]) by postgresql.org (Postfix) with ESMTP id 29C799FB614 for ; Mon, 23 Apr 2007 11:56:46 -0300 (ADT) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES X-Real-To: jeroen.kleijer@xs4all.nl, pgsql-performance@postgresql.org Received: from [63.226.156.118] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 137069890; Mon, 23 Apr 2007 07:56:44 -0700 From: "Dave Dutcher" To: "'Jeroen Kleijer'" , Subject: Re: not using indexes on large table Date: Mon, 23 Apr 2007 09:56:46 -0500 Message-ID: <004601c785b7$9dda0950$0300000a@tridecap.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6822 In-Reply-To: <20070421201742.GB99389@penrose.jmkdomain.lan> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-Index: AceEVmIGdXnViYLAQKydBrh8C5WOXwBX6UGQ Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.105 tagged_above=0 required=5 tests=AWL=0.104, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200704/390 X-Sequence-Number: 24267 > From: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 > Jeroen Kleijer > > The problems comes when I try to do a query without using a=20 > where clause > because by then, it completely discards the indexes and does=20 > a complete > table scan which takes over half an hour! (40.710.725 rows, 1110258 > pages, 1715 seconds) >=20 > I've tried several things but doing a query like: > select distinct volume from project_access_times > or > select distinct qtree from project_access_times > always result in a full sequential table scan even after a=20 > 'vacuum' and > 'vacuum analyze'. To my knowledge Postgres doesn't use indexes for distinct queries or grouping. Also you are getting horrible IO performance. Our old slow = test machine can scan a table of 12 million rows in 100 seconds, and our production server can do the same in 20 seconds. If possible, I would = try running the same thing on your local hard drive. That way you can see = how much the netapp and NFS are slowing you down. Although in the end if = you need very fast distinct queries, you will need to maintain a separate = table. Dave