X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5E684D1B9A4 for ; Thu, 11 Mar 2004 19:02:22 +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 38436-10 for ; Thu, 11 Mar 2004 15:02:19 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 4AEEAD1CCB1 for ; Thu, 11 Mar 2004 15:02:13 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i2BJ2BdV021846; Thu, 11 Mar 2004 14:02:12 -0500 (EST) To: Mike Moran Cc: PgSQL Performance ML Subject: Re: Impact of varchar/text in use of indexes In-reply-to: <4050AF10.9060006@mac.com> References: <4050AF10.9060006@mac.com> Comments: In-reply-to Mike Moran message dated "Thu, 11 Mar 2004 18:25:20 +0000" Date: Thu, 11 Mar 2004 14:02:11 -0500 Message-ID: <21844.1079031731@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/153 X-Sequence-Number: 6009 Mike Moran writes: > Hi. I have two existing tables, A and B. A has a 'varchar(1000)' field > and B has a 'text' field, each with btree indexes defined. When I do a > join between these, on this field, it seems to a hash join, as opposed > to using the indexes, as I might expect (I'm no postgres expert, btw). > My question is: if I changed both fields to be text or varchar(1000) > then would the index be used? Probably not, and in any case your assumption is mistaken. Indexes are not always the right way to join. regards, tom lane