X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 57387D1B53B for ; Tue, 14 Oct 2003 00:21:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 66182-07 for ; Mon, 13 Oct 2003 21:20:46 -0300 (ADT) Received: from smtp.noos.fr (nan-smtp-15.noos.net [212.198.2.123]) by svr1.postgresql.org (Postfix) with ESMTP id 6AD90D1B544 for ; Mon, 13 Oct 2003 21:20:44 -0300 (ADT) Received: (qmail 13298 invoked by uid 0); 14 Oct 2003 00:20:46 -0000 Received: from unknown (HELO bigfoot.com) ([::ffff:212.198.37.110]) (envelope-sender ) by ::ffff:212.198.2.123 (qmail-ldap-1.03) with SMTP for ; 14 Oct 2003 00:20:46 -0000 Message-ID: <3F8B4158.2030600@bigfoot.com> Date: Tue, 14 Oct 2003 02:20:40 +0200 From: Gaetano Mendola User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030901 Thunderbird/0.2 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "pgsql-hackers@postgresql.org" Cc: Tom Lane Subject: Re: ways to force index use? References: <3743.1066089715@sss.pgh.pa.us> In-Reply-To: <3743.1066089715@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/629 X-Sequence-Number: 45311 Tom Lane wrote: > Seth Ladd writes: > >>My Table Columns (all bigints): start, stop, step1, step2, step3 > > ^^^^^^^^^^^ > > >>The Query: explain analyze select * from path where start = 653873 or >>start = 649967 or stop = 653873 or stop = 649967 > > >>Does anyone have a suggestion on how to get that query to use an index? > > > Coerce the constants to bigint, for starters. However, a query that is > selecting almost 10% of the table, as your example is, probably > *shouldn't* be using an index. I think that for 10% is still better and Index scan. There is around a way to calculate this elbow ? Regards Gaetano Mendola