From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Creager <Robert_Creager@LogicalChaos.org>
Cc: Michael Fuhr <mike@fuhr.org>
Cc: PGPerformance <pgsql-performance@postgresql.org>
Subject: Re: Index isn't used during a join.
Date: Wed, 11 Jan 2006 10:33:03 -0500
Message-ID: <12877.1136993583@sss.pgh.pa.us> (raw)
In-Reply-To: <20060111072659.7c1772ad@thunder.logicalchaos.org>
References: <20060109212338.6420af12@thunder.logicalchaos.org>
<20060110055818.GA55076@winnie.fuhr.org>
<20060110221055.053596ab@thunder.logicalchaos.org>
<20060111075655.GA51292@winnie.fuhr.org>
<20060111072659.7c1772ad@thunder.logicalchaos.org>
Robert Creager <Robert_Creager@LogicalChaos.org> writes:
> What I had thought is that PG would (could?) be smart enough to realize tha=
> t one query was restricted, and apply that restriction to the other based o=
> n the join. I know it works in other cases (using indexes on both tables u=
> sing the join)...
The planner understands about transitivity of equality, ie given a = b
and b = c it can infer a = c. It doesn't do any such thing for
inequalities though, nor does it deduce f(a) = f(b) for arbitrary
functions f. The addition Michael suggested requires much more
understanding of the properties of the functions in your query than
I think would be reasonable to put into the planner.
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-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, Robert_Creager@LogicalChaos.org, mike@fuhr.org
Subject: Re: Index isn't used during a join.
In-Reply-To: <12877.1136993583@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