Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id D2A6D2E3432 for ; Mon, 14 Jan 2008 10:34:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 92549-06 for ; Mon, 14 Jan 2008 10:34:31 -0400 (AST) Received: from mail.mnc.ch (62-2-77-205.static.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id 95E222E3448 for ; Mon, 14 Jan 2008 10:34:39 -0400 (AST) Received: from localhost (mail2.mnc.ch [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id 2A32E2307A; Mon, 14 Jan 2008 14:35:19 +0000 (GMT) X-Virus-Scanned: amavisd-new at mnc.ch Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail2.mnc.ch [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id RjIqkZXQ9+ds; Mon, 14 Jan 2008 14:35:18 +0000 (GMT) Received: from meuh.localdomain (62-2-77-204.static.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 8D6C623073; Mon, 14 Jan 2008 14:35:18 +0000 (GMT) Received: by meuh.localdomain (Postfix, from userid 1000) id 8B92A183733; Mon, 14 Jan 2008 15:34:36 +0100 (CET) To: Yannick Le =?iso-8859-1?Q?Gu=E9dart?= Cc: pgsql-performance@postgresql.org Subject: Re: Seq scans on indexed columns. References: <1200320331.14406.32.camel@yannick> From: Guillaume Cottenceau X-Hashcash: 1:20:080114:yannick@over-blog.com::sWpi6ly2VwsOfEJ6:00000000000000000000000000000000000000004cDV X-Hashcash: 1:20:080114:pgsql-performance@postgresql.org::2dSNBVqJf8CctDvv:000000000000000000000000000000iRG Date: Mon, 14 Jan 2008 15:34:36 +0100 In-Reply-To: <1200320331.14406.32.camel@yannick> ("Yannick Le =?iso-8859-1?Q?Gu=E9dart=22's?= message of "Mon\, 14 Jan 2008 15\:18\:51 +0100") Message-ID: <87prw48ohv.fsf@messaging.mobileway.com> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/117 X-Sequence-Number: 28356 Yannick Le Guédart writes: > Greetings, > > I was trying to get informations on #portgresql about a query plan I > think is quite strange, and I was said to post on this list. I hope my > mail will be clear enough. I have included the query, the query plan, > and the table definitions. I just don't understand the "Seq Scan" on > fileds that are indexed. This is a FAQ entry (curious that the people there didn't direct you to the FAQ first): http://www.postgresql.org/docs/faqs.FAQ.html#item4.6 It's possible that more than 800,000 rows is not a "small percentage of the rows in the table", and also there's the fact that "indexes are normally not used (..) to perform joins". Also, your database may not be analyzed, or not properly tuned (for example, it seems that the default random_page_cost of 4 is too large for current disks - at least for us, we've found that 2 is more correct) [...] > -> Seq Scan on _user (cost=0.00..205537.72 rows=806972 width=24) -- Guillaume Cottenceau, MNC Mobile News Channel SA, an Alcatel-Lucent Company Av. de la Gare 10, 1003 Lausanne, Switzerland - direct +41 21 317 50 36