X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0EFE153395 for ; Thu, 12 May 2005 16:11:48 -0300 (ADT) 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 94942-02 for ; Thu, 12 May 2005 19:11:38 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id AF4FB52A35 for ; Thu, 12 May 2005 16:11:36 -0300 (ADT) 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 j4CJBaDX011485; Thu, 12 May 2005 15:11:36 -0400 (EDT) To: dbadmin@nqadmin.com Cc: pgsql-admin@postgresql.org Subject: Re: Query Plan - Index Scan & Seq Scan In-reply-to: <428387D2.8050200@nqadmin.com> References: <428370AC.3070207@nqadmin.com> <886.1115910870@sss.pgh.pa.us> <428379E0.4010709@nqadmin.com> <2052.1115913920@sss.pgh.pa.us> <428381C3.80205@nqadmin.com> <6708.1115915406@sss.pgh.pa.us> <428387D2.8050200@nqadmin.com> Comments: In-reply-to Prasanth message dated "Thu, 12 May 2005 11:44:02 -0500" Date: Thu, 12 May 2005 15:11:36 -0400 Message-ID: <11484.1115925096@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/167 X-Sequence-Number: 17596 Prasanth writes: > Seems like having int2 after code is doing the trick. > Can you please explain the reasons behind this. When you write "int2col > 2", the operator that is selected is int2-gt-int4. However the index on an int2 column can only deal with int2-gt-int2. 8.0 generalized the index mechanism enough to allow int2 indexes to deal with int2-gt-int4, but in earlier releases you have to take care to make the constant an int2. int8 columns have the same issue from the other direction ... regards, tom lane