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

From: a3a18850(at)telus(dot)net
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Mischa <mischa(dot)Sandberg(at)telus(dot)net>, 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-08 00:30:11
Message-ID: 1112920211.4255d0934e23d@webmail.telus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Quoting Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> 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 [...]
> but I'm less able to think of common use-cases for transitive
> inequality ...

Thanks. My apologies for not just going and looking at the code first.

Equality-transitives: yes, worth their weight in gold.
Inequality-transitivies: I see in OLAP queries (usually ranges), or in queries
against big UNION ALL views, where const false inequalities are the norm.
"a.x > b.y and a.x < c.z" comes up in OLAP, too, usually inside an EXISTS(...),
where you are doing something analogous to finding a path.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2005-04-08 00:48:12 Re: Call for objections: merge Resdom with TargetEntry
Previous Message Bernd Helmle 2005-04-08 00:27:46 Re: Call for objections: merge Resdom with TargetEntry

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Sabino Mullane 2005-04-08 01:30:10 Re: help on explain analyse in psql 7.1.3 (linux)
Previous Message Tom Lane 2005-04-07 23:58:56 Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)