X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 0B20211F6240 for ; Tue, 25 Apr 2006 12:23:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 36477-01 for ; Tue, 25 Apr 2006 12:23:09 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 6A0C511F6260 for ; Tue, 25 Apr 2006 12:23:07 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k3PFN00e019484; Tue, 25 Apr 2006 11:23:00 -0400 (EDT) To: arnaulist@andromeiberica.com cc: chris smith , pgsql-performance@postgresql.org Subject: Re: Query on postgresql 7.4.2 not using index In-reply-to: <444E28ED.3090900@andromeiberica.com> References: <444E240D.3050000@andromeiberica.com> <3c1395330604250634r6f215ceame157f3dd5f5f4fa3@mail.gmail.com> <444E28ED.3090900@andromeiberica.com> Comments: In-reply-to Arnau message dated "Tue, 25 Apr 2006 15:49:33 +0200" Date: Tue, 25 Apr 2006 11:22:59 -0400 Message-ID: <19483.1145978579@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/549 X-Sequence-Number: 18633 Arnau writes: > Seq Scan on agenda_users_groups (cost=0.00..53108.45 rows=339675 > width=8) (actual time=916.903..5763.830 rows=367026 loops=1) > Filter: (group_id = 9::numeric) > Total runtime: 7259.861 ms > (3 filas) > espsm_moviltelevision=# select count(*) from agenda_users_groups ; > count > --------- > 2547556 So the SELECT is fetching nearly 15% of the rows in the table. The planner is doing *the right thing* to use a seqscan, at least for this particular group_id value. regards, tom lane