Re: [HACKERS] Hypothetical suggestions for planner,

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: PgSQL Performance ML <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [HACKERS] Hypothetical suggestions for planner,
Date: 2003-05-06 11:49:15
Message-ID: 1052221755.3368.286.camel@haggis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Mon, 2003-05-05 at 23:25, Tom Lane wrote:
> Josh Berkus <josh(at)agliodbs(dot)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(dot)l(dot)johnson(at)cox(dot)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. |
+---------------------------------------------------------------+

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Karsten Hilbert 2003-05-06 12:23:56 Re: Installin Postgres
Previous Message Patrick Macdonald 2003-05-06 11:04:37 Re: 7.4 features list

Browse pgsql-performance by date

  From Date Subject
Next Message Fabio C. Bon 2003-05-06 12:21:16 A query with performance problems.
Previous Message Ron Johnson 2003-05-06 11:04:06 Re: Looking for a cheap upgrade (RAID)