Re: [HACKERS] Hypothetical suggestions for planner, - Mailing list pgsql-performance

From Ron Johnson
Subject Re: [HACKERS] Hypothetical suggestions for planner,
Date
Msg-id 1052221755.3368.286.camel@haggis
Whole thread Raw
In response to Re: [HACKERS] Hypothetical suggestions for planner, indexing improvement  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
On Mon, 2003-05-05 at 23:25, Tom Lane wrote:
> Josh Berkus <josh@agliodbs.com> writes:
> > THE IDEA:  The planner should keep statistics on the correlation of foreign
> > keys and apply them to the expected row counts for EXISTS clause limitations,
> > and possibly for other query types as well.
>
> It's a thought.  Keeping complete cross-column correlation stats (for
> every combination of columns in the DB) is obviously out of the
> question.  If you're gonna do it you need a heuristic to tell you which
> combinations of columns are worth keeping track of --- and foreign-key
> relationships seem like a reasonable guide to the interesting
> combinations.

How about generalizing this into something useful for all queries?

And to make this problem not just guess work on the part of the
optimizer, how about having a separate "backslash command" so that
the DBA can add specific/important/crucial predicates that he needs
optimized.

Thus, if there's a query with a large WHERE clause that has an
optimized predicate inside it, the statistics would be used.

> WHERE event_day BETWEEN '2003-04-08' AND '2003-05-18')

What this sounds to me like, though, is that in order for it to
work quickly, the postmaster would have to keep track in system
tables each value of event_day and it's COUNT(*), thus more I/O
overhead.

--
+---------------------------------------------------------------+
| Ron Johnson, Jr.        mailto:ron.l.johnson@cox.net          |
| Jefferson, LA  USA      http://members.cox.net/ron.l.johnson  |
|                                                               |
| The purpose of the military isn't to pay your college tuition |
| or give you a little extra income; it's to "kill people and   |
| break things".  Surprisingly, not everyone understands that.  |
+---------------------------------------------------------------+


pgsql-performance by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Looking for a cheap upgrade (RAID)
Next
From: Richard Huxton
Date:
Subject: Re: Select on timestamp-day slower than timestamp alone