From: | "Jim C(dot) Nasby" <decibel(at)decibel(dot)org> |
---|---|
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: [HACKERS] Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) |
Date: | 2005-04-07 21:40:15 |
Message-ID: | 20050407214015.GT93835@decibel.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-performance |
On Wed, Apr 06, 2005 at 06:35:10PM -0400, Tom Lane wrote:
> "Jim C. Nasby" <decibel(at)decibel(dot)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.
Actually, it might be possible to take a SWAG at it using the histogram
and correlation stats.
You know... since getting universally useful cross-platform stats seems
to be pretty pie-in-the-sky, would it be possible to generate more
complex stats on the fly from a sampling of a table? If you're looking
at a fairly sizeable table ISTM it would be worth sampling the rows on
10 or 20 random pages to see what you get. In this case, you'd want to
know the average difference between two fields. Other queries might want
something different.
--
Jim C. Nasby, Database Consultant decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2005-04-07 22:31:52 | Re: prepared statements don't log arguments? |
Previous Message | Mischa | 2005-04-07 21:26:38 | Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) |
From | Date | Subject | |
---|---|---|---|
Next 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) |
Previous Message | Mischa | 2005-04-07 21:26:38 | Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) |