From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Darley <pdarley@kinesis-cem.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query Plan far worse in 7.3.2 than 7.2.1
Date: Wed, 30 Apr 2003 10:54:27 -0400
Message-ID: <22179.1051714467@sss.pgh.pa.us> (raw)
In-Reply-To: <NNEAICKPNOGDBHNCEDCPIEHGDMAA.pdarley@kinesis-cem.com>
References: <NNEAICKPNOGDBHNCEDCPIEHGDMAA.pdarley@kinesis-cem.com>
"Peter Darley" <pdarley@kinesis-cem.com> writes:
> SELECT COUNT(*) FROM Border_Shop_List WHERE NOT EXISTS (SELECT Foreign_Key=
> FROM Sample WHERE Foreign_Key=3D'Quantum_' || Border_Shop_List.Assignment_=
> ID || '_' || Assignment_Year || '_' || Evaluation_ID)
What's the datatype of Foreign_Key?
I'm betting that it's varchar(n) or char(n). The result of the ||
expression is text, and so the comparison can't use a varchar index
unless you explicitly cast it to varchar:
WHERE Foreign_Key = ('Quantum_' || ... || Evaluation_ID)::varchar
I think 7.2 had some kluge in it that would allow a varchar index to be
used anyway, but we took out the kluge because it was semantically wrong
(it would also allow use of a char(n) index in place of a text
comparison, which alters the semantics...)
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, pdarley@kinesis-cem.com, pgsql-performance@postgresql.org
Subject: Re: Query Plan far worse in 7.3.2 than 7.2.1
In-Reply-To: <22179.1051714467@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox