Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 4E2F86338A4 for ; Mon, 30 Mar 2009 11:16:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 06528-10 for ; Mon, 30 Mar 2009 11:16:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 9E151633771 for ; Mon, 30 Mar 2009 11:16:26 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n2UEGBcg003029; Mon, 30 Mar 2009 10:16:11 -0400 (EDT) To: Mario Splivalo cc: pgsql-performance@postgresql.org Subject: Re: Forcing seq_scan off for large table joined with tiny table yeilds improved performance In-reply-to: <49D0D237.7020308@megafon.hr> References: <49D0D237.7020308@megafon.hr> Comments: In-reply-to Mario Splivalo message dated "Mon, 30 Mar 2009 16:07:51 +0200" Date: Mon, 30 Mar 2009 10:16:11 -0400 Message-ID: <3028.1238422571@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.019 tagged_above=0 required=5 tests=AWL=0.019 X-Spam-Level: X-Archive-Number: 200903/407 X-Sequence-Number: 33329 Mario Splivalo writes: > -> Bitmap Heap Scan on photo_info_data u (cost=39134.84..63740.08 > rows=109024 width=50) (actual time=270.464..270.469 rows=3 loops=2) > Recheck Cond: ((u.field_name)::text = (t.key)::text) > -> Bitmap Index Scan on photo_info_data_pk > (cost=0.00..39107.59 rows=109024 width=0) (actual time=270.435..270.435 > rows=3 loops=2) > Index Cond: ((u.field_name)::text = (t.key)::text) You need to figure out why that rowcount estimate is off by more than four orders of magnitude :-( regards, tom lane