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 1981311F68D4 for ; Thu, 30 Mar 2006 08:02:15 -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 30818-09 for ; Thu, 30 Mar 2006 08:02:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 2875611F61D3 for ; Thu, 30 Mar 2006 08:02:11 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FOvqs-00047F-Ed; Thu, 30 Mar 2006 14:02:10 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FOvqo-0003PL-00; Thu, 30 Mar 2006 14:02:06 +0200 Date: Thu, 30 Mar 2006 14:02:06 +0200 From: "Steinar H. Gunderson" To: Peter Eisentraut Cc: pgsql-performance@postgresql.org Subject: Re: Index scan startup time Message-ID: <20060330120206.GA13075@uio.no> Mail-Followup-To: Peter Eisentraut , pgsql-performance@postgresql.org References: <200603301359.11038.peter_e@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200603301359.11038.peter_e@gmx.net> X-Operating-System: Linux 2.6.14.3 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.1 required=5 tests=[AWL=0.100] X-Spam-Score: 0.1 X-Spam-Level: X-Archive-Number: 200603/608 X-Sequence-Number: 18045 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? /* Steinar */ -- Homepage: http://www.sesse.net/