From: Bruno Wolff III <bruno@wolff.to>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Arjen van der Meijden <acmmailing@vulcanus.its.tudelft.nl>
Cc: pgsql-hackers@postgreSQL.org
Cc: pgsql-performance@postgreSQL.org
Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)
Date: Thu, 7 Apr 2005 09:31:20 -0500
Message-ID: <20050407143120.GA29575@wolff.to> (raw)
In-Reply-To: <6326.1112825377@sss.pgh.pa.us>
References: <425413D3.5030304@vulcanus.its.tudelft.nl>
<28552.1112809334@sss.pgh.pa.us>
<425423A9.9000504@vulcanus.its.tudelft.nl>
<5999.1112820690@sss.pgh.pa.us>
<6326.1112825377@sss.pgh.pa.us>
On Wed, Apr 06, 2005 at 18:09:37 -0400,
Tom Lane <tgl@sss.pgh.pa.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.
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: bruno@wolff.to, tgl@sss.pgh.pa.us, acmmailing@vulcanus.its.tudelft.nl, pgsql-hackers@postgreSQL.org
Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient)
In-Reply-To: <20050407143120.GA29575@wolff.to>
* 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