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 5FAC4D1BA48 for ; Thu, 18 Mar 2004 18:52:49 +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 75637-01 for ; Thu, 18 Mar 2004 14:52:46 -0400 (AST) Received: from mail3.panix.com (mail3.panix.com [166.84.1.74]) by svr1.postgresql.org (Postfix) with ESMTP id 249F8D1DD0F for ; Thu, 18 Mar 2004 14:52:40 -0400 (AST) Received: from panix3.panix.com (panix3.panix.com [166.84.1.3]) by mail3.panix.com (Postfix) with ESMTP id C37F29873F for ; Thu, 18 Mar 2004 13:52:37 -0500 (EST) Received: (from adler@localhost) by panix3.panix.com (8.11.6p2-a/8.8.8/PanixN1.1) id i2IIqbQ05537 for pgsql-performance@postgresql.org; Thu, 18 Mar 2004 13:52:37 -0500 (EST) Date: Thu, 18 Mar 2004 13:52:37 -0500 From: Michael Adler To: pgsql-performance@postgresql.org Subject: string casting for index usage Message-ID: <20040318185237.GA3568@pobox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/259 X-Sequence-Number: 6115 In porting an application from v7.2 and v7.3, I noticed that a join on a varchar column and a text column was ignoring indices that were helpful in v7.2. When I explicitly cast the text to a varchar (or set ENABLE_SEQSCAN TO false) the index is scanned and it works as efficiently as in v7.2. Obviously there were many casting improvements made in 7.3, but our application doesn't exactly see it that way. Is explicit casting the only solution (other than schema modification)? I haven't found anything in the documentation on this subject. Thanks, Mike