From: John A Meinel <john@arbash-meinel.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jim C. Nasby <decibel@decibel.org>
Cc: Arjen van der Meijden <acmmailing@vulcanus.its.tudelft.nl>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-performance@postgresql.org
Subject: Re: [HACKERS] Recognizing range constraints (was Re: Plan
Date: Wed, 06 Apr 2005 17:54:07 -0500
Message-ID: <4254688F.6070009@arbash-meinel.com> (raw)
In-Reply-To: <6594.1112826910@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>
<20050406222536.GL93835@decibel.org>
<6594.1112826910@sss.pgh.pa.us>
Tom Lane wrote:
> "Jim C. Nasby" <decibel@decibel.org> writes:
>
>>On Wed, Apr 06, 2005 at 06:09:37PM -0400, Tom Lane 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
>
>
>>In a case like this, you could actually look at the data in b and see
>>what the average range size is.
>
>
> Not with the current statistics --- you'd need some kind of cross-column
> statistics involving both y and z. (That is, I doubt it would be
> helpful to estimate the average range width by taking the difference of
> independently-calculated mean values of y and z ...) But yeah, in
> principle it would be possible to make a non-default estimate.
>
> regards, tom lane
Actually, I think he was saying do a nested loop, and for each item in
the nested loop, re-evaluate if an index or a sequential scan is more
efficient.
I don't think postgres re-plans once it has started, though you could
test this in a plpgsql function.
John
=:->
Attachments:
signature.asc (application/pgp-signature, 250B) download
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: john@arbash-meinel.com, tgl@sss.pgh.pa.us, decibel@decibel.org, acmmailing@vulcanus.its.tudelft.nl, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Recognizing range constraints (was Re: Plan
In-Reply-To: <4254688F.6070009@arbash-meinel.com>
* 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