Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mischa <mischa(dot)Sandberg(at)telus(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)
Date: 2005-04-07 23:58:56
Message-ID: 23152.1112918336@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Mischa <mischa(dot)Sandberg(at)telus(dot)net> writes:
> Quoting Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> WHERE a.x > b.y AND a.x < 42

> Out of curiosity, will the planner induce "b.y < 42" out of this?

No. There's some smarts about transitive equality, but none about
transitive inequalities. Offhand I'm not sure if it'd be useful to add
such. The transitive-equality code pulls its weight because you so
often have situations like

create view v as select a.x, ... from a join b on (a.x = b.y);

select * from v where x = 42;

but I'm less able to think of common use-cases for transitive
inequality ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2005-04-08 00:27:46 Re: Call for objections: merge Resdom with TargetEntry
Previous Message Palle Girgensohn 2005-04-07 22:51:16 Re: prepared statements don't log arguments?

Browse pgsql-performance by date

  From Date Subject
Next Message a3a18850 2005-04-08 00:30:11 Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)
Previous Message Jim C. Nasby 2005-04-07 21:40:15 Re: [HACKERS] Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)