Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eAHLgos70239 for ; Fri, 17 Nov 2000 16:42:50 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id eAHLdrO14143; Fri, 17 Nov 2000 16:39:53 -0500 (EST) To: "Ingram, Bryan" cc: "'pgsql-sql@postgresql.org'" Subject: Re: Why is this doing a seq scan? In-reply-to: <01CCE949D2717845BA2E573DC081167E052FB0@BKMAIL.sfsinternal.com> References: <01CCE949D2717845BA2E573DC081167E052FB0@BKMAIL.sfsinternal.com> Comments: In-reply-to "Ingram, Bryan" message dated "Fri, 17 Nov 2000 14:55:04 -0600" Date: Fri, 17 Nov 2000 16:39:53 -0500 Message-ID: <14140.974497193@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200011/144 X-Sequence-Number: 175 "Ingram, Bryan" writes: >> Also it would be useful to see the full declarations of the tables >> and their indexes; I'm wondering what datatype the zip columns are, >> for example. > Table = atms > | zip | text | > Table = zips > | zip | varchar() | Ah, there's your problem --- the planner is not very smart about optimizing cross-datatype comparisons. Make these columns both text, or both varchar, and I'll bet you get a more intelligent plan. Current sources (7.1-to-be) are a little smarter than 7.0 about cross-data-type joins, but they still don't get this case right. I have a TODO item about that, but I dunno if it'll get done before 7.1 ... regards, tom lane