X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CCA6111F68EF for ; Thu, 30 Mar 2006 08:23:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38102-02 for ; Thu, 30 Mar 2006 08:23:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gauss.credativ.com (ipx11302.ipxserver.de [212.112.227.254]) by postgresql.org (Postfix) with ESMTP id 94C1E11F68FA for ; Thu, 30 Mar 2006 08:23:57 -0400 (AST) Received: from bell.credativ.de (p50896DF7.dip.t-dialin.net [80.137.109.247]) (using TLSv1 with cipher EXP1024-RC4-SHA (56/128 bits)) (No client certificate requested) by gauss.credativ.com (Postfix) with ESMTP id 243F9D75F4; Thu, 30 Mar 2006 14:23:53 +0200 (CEST) From: Peter Eisentraut To: "Steinar H. Gunderson" Subject: Re: Index scan startup time Date: Thu, 30 Mar 2006 14:23:53 +0200 User-Agent: KMail/1.8.3 Cc: pgsql-performance@postgresql.org References: <200603301359.11038.peter_e@gmx.net> <20060330120206.GA13075@uio.no> In-Reply-To: <20060330120206.GA13075@uio.no> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200603301423.54510.peter_e@gmx.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.105 required=5 tests=[AWL=0.105] X-Spam-Score: 0.105 X-Spam-Level: X-Archive-Number: 200603/610 X-Sequence-Number: 18047 Am Donnerstag, 30. März 2006 14:02 schrieb Steinar H. Gunderson: > On Thu, Mar 30, 2006 at 01:59:10PM +0200, Peter Eisentraut wrote: > > EXPLAIN ANALYZE select activity_id from activity where state in (10000, > > 10001) order by activity_id limit 100; > > > > QUERY PLAN > > > > Limit (cost=0.00..622.72 rows=100 width=8) (actual > > time=207356.054..207356.876 rows=100 loops=1) > > -> Index Scan using activity_pk on activity (cost=0.00..40717259.91 > > rows=6538650 width=8) (actual time=207356.050..207356.722 rows=100 > > loops=1) Filter: ((state = 10000) OR (state = 10001)) > > Total runtime: 207357.000 ms > > > > The table has seen VACUUM FULL and REINDEX before this. > > The index scan is by activity_id, not by state. Do you have an index on > state at all? There is an index on state as well but the column is not selective enough. -- Peter Eisentraut http://developer.postgresql.org/~petere/