Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 12C119FB6CD for ; Sat, 21 Apr 2007 18:16:26 -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 57953-06 for ; Sat, 21 Apr 2007 18:16:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from heaven.kostyrka.org (h1634.serverkompetenz.net [81.169.154.44]) by postgresql.org (Postfix) with ESMTP id 4EE279FB55D for ; Sat, 21 Apr 2007 18:16:22 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by heaven.kostyrka.org (Postfix) with ESMTP id 55C414FB8C; Sat, 21 Apr 2007 23:16:19 +0200 (CEST) Received: from heaven.kostyrka.org ([127.0.0.1]) by localhost (heaven.kostyrka.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03647-05; Sat, 21 Apr 2007 23:16:19 +0200 (CEST) Received: from andi-lap (localhost [127.0.0.1]) by heaven.kostyrka.org (Postfix) with SMTP id A5B654FB88; Sat, 21 Apr 2007 23:16:17 +0200 (CEST) Received: by andi-lap (sSMTP sendmail emulation); Sat, 21 Apr 2007 23:17:04 +0200 Date: Sat, 21 Apr 2007 23:17:04 +0200 From: Andreas Kostyrka To: Jeroen Kleijer Cc: pgsql-performance@postgresql.org Subject: Re: not using indexes on large table Message-ID: <20070421211704.GS4118@andi-lap> References: <20070421201742.GB99389@penrose.jmkdomain.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070421201742.GB99389@penrose.jmkdomain.lan> User-Agent: mutt-ng/devel-r804 (Debian) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/363 X-Sequence-Number: 24240 * Jeroen Kleijer [070421 23:10]: > > Hi all, > > I'm a bit new to PostgreSQL and database design in general so forgive me > for asking stupid questions. ;-) > > I've setup a PostgreSQL database on a Linux machine (2 processor, 1GB > mem) and while the database itself resides on a NetApp filer, via NFS, > this doesn't seem to impact the performance to drastically. > > I basically use it for indexed tables without any relation between 'em > so far this has worked perfectly. > > For statistics I've created the following table: > volume varchar(30), > qtree varchar(255), > file varchar(512), > ctime timestamp, > mtime timestamp, > atime timestamp > annd created separate indexes on the volume and qtree columns. > > This table gets filled with the copy command and about 2 hours and > some 40 million records later I issue a reindex command to make sure the > indexes are accurate. (for good interest, there are some 35 values for > volume and some 1450 for qtrees) > > While filling of this table, my database grows to an (expected) 11.5GB. > > The problems comes when I try to do a query without using a where clause > because by then, it completely discards the indexes and does a complete > table scan which takes over half an hour! (40.710.725 rows, 1110258 > pages, 1715 seconds) > > 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 'vacuum' and > 'vacuum analyze'. Try: select volume from project_access_times group by project_access_times; And no matter, runnning a database over NFS smells like a dead rat. Hopefully, you've mounted it hard, but still NFS does not have normal semantics, e.g. locking, etc. Next thing, as you've got only one client for that NFS mount, try to make it to cache aggressivly meta data. The ac prefixed options in nfs(5) come to mind. Andreas