X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E03332AA03 for ; Tue, 12 Oct 2004 06:27:05 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93247-03 for ; Tue, 12 Oct 2004 05:26:56 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 98625329E25 for ; Tue, 12 Oct 2004 06:26:56 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i9C5QrYI028284; Tue, 12 Oct 2004 01:26:53 -0400 (EDT) To: Francisco Reyes Cc: John Meinel , pgsql-performance@postgresql.org Subject: Re: why my query is not using index?? In-reply-to: <20041012005231.U98867@zoraida.natserv.net> References: <41639F3C.4050103@siche.net> <200410111425.02671.vygen@gmx.de> <20041011163756.M97379@zoraida.natserv.net> <416B217D.9090000@johnmeinel.com> <20041012005231.U98867@zoraida.natserv.net> Comments: In-reply-to Francisco Reyes message dated "Tue, 12 Oct 2004 00:56:15 -0400" Date: Tue, 12 Oct 2004 01:26:53 -0400 Message-ID: <28283.1097558813@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/156 X-Sequence-Number: 8632 Francisco Reyes writes: > With explain analyze I have with sequential scan on > Sort (cost=382.01..382.15 rows=56 width=196) > (actual time=64.346..64.469 rows=24 loops=1) > And with seqscan off > Sort (cost=490.82..490.96 rows=56 width=196) > (actual time=56.668..56.789 rows=24 loops=1) > So I guess that for this particular query I am better off setting the > seqscan off. For that kind of margin, you'd be a fool to do any such thing. You might want to look at making some adjustment to random_page_cost to bring the estimated costs in line with reality (though I'd counsel taking more than one example into account while you tweak it). But setting seqscan off as a production setting is just a recipe for shooting yourself in the foot. regards, tom lane