Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 7295F9FA474 for ; Tue, 3 Oct 2006 09:10:12 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 77351-07 for ; Tue, 3 Oct 2006 12:10:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from lynet.oppetid.no (oppetid.no [80.65.51.2]) by postgresql.org (Postfix) with ESMTP id C684B9FA3D7 for ; Tue, 3 Oct 2006 09:10:07 -0300 (ADT) Received: by lynet.oppetid.no (Postfix, from userid 1019) id 593F0119F9F; Tue, 3 Oct 2006 14:10:04 +0200 (CEST) Date: Tue, 3 Oct 2006 14:10:04 +0200 From: Tobias Brox To: Arnaud Lesauvage Cc: pgsql-performance@postgresql.org Subject: Re: Poor performance on very simple query ? Message-ID: <20061003121004.GC30211@oppetid.no> References: <45224896.7040708@freesurf.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45224896.7040708@freesurf.fr> Organization: Group Nordicbet User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/33 X-Sequence-Number: 21162 [Arnaud Lesauvage - Tue at 01:25:10PM +0200] > I have a performance problem, but I am not sure whether it really > is a problem or not. > QUERY PLAN > ------------------------------------------------------------------------------------------------------------------------------------------------------ > Seq Scan on table1 (cost=0.00..23.69 rows=10 width=35) (actual > time=0.023..0.734 rows=7 loops=1) > Filter: ((gid = 33) OR (gid = 110) OR (gid = 65) OR (gid = 84) > OR (gid = 92) OR (gid = 94) OR (gid = 13) OR (gid = 7) OR (gid = > 68) OR (gid = 41)) > Total runtime: 0.801 ms > (3 rows) > > I have run "VACUUM FULL" on this table many times... I don't know > what to try next ! > What is wrong here (because I hope that something is wrong) ? > Thanks a lot for your help ! Did you try "analyze" as well? It's weird it's using seq scan, since you have a primary key it's supposed to have an index ... though 500 rows is little. I just checked up our own production database, takes 0.08 ms to fetch a row by ID from one of our tables containing 176k with rows.