From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Arjen van der Meijden <acmmailing(at)vulcanus(dot)its(dot)tudelft(dot)nl>, pgsql-hackers(at)postgreSQL(dot)org, 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 14:31:20 |
Message-ID: | 20050407143120.GA29575@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-performance |
On Wed, Apr 06, 2005 at 18:09:37 -0400,
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Can anyone suggest a more general rule? Do we need for example to
> consider whether the relation membership is the same in two clauses
> that might be opposite sides of a range restriction? It seems like
>
> a.x > b.y AND a.x < b.z
>
> probably can be treated as a range restriction on a.x for this purpose,
> but I'm much less sure that the same is true of
>
> a.x > b.y AND a.x < c.z
>
> Thoughts?
I think it makes sense to guess that a smaller fraction of the rows will
be returned when a column value is bounded above and below than if it
is only bounded on one side, even if the bounds aren't fixed. You can
certainly be wrong. The difference between this and the normal case is that
column statistics aren't normally going to be that useful.
If date/time ranges are the common use for this construct, it might be better
to create date and/or time range types that use rtree or gist indexes.
From | Date | Subject | |
---|---|---|---|
Next Message | Mischa | 2005-04-07 21:26:38 | Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) |
Previous Message | Tom Lane | 2005-04-07 14:20:24 | Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) |
From | Date | Subject | |
---|---|---|---|
Next Message | Joel Fradkin | 2005-04-07 15:13:57 | Any way to speed this up? |
Previous Message | Tom Lane | 2005-04-07 14:20:24 | Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) |