pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron Johnson <ron.l.johnson@cox.net>
To: PgSQL Performance ML <pgsql-performance@postgresql.org>
Subject: Re: [HACKERS] Hypothetical suggestions for planner,
Date: 06 May 2003 06:49:15 -0500
Message-ID: <1052221755.3368.286.camel@haggis> (raw)
In-Reply-To: <22292.1052195133@sss.pgh.pa.us>
References: <200305051219.58955.josh@agliodbs.com>
	<22292.1052195133@sss.pgh.pa.us>

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.  |
+---------------------------------------------------------------+




Message-ID: <1052221755.3368.286.camel@haggis>
Permalink:  ../1052221755.3368.286.camel@haggis/
Also on:    postgresql.org/message-id/1052221755.3368.286.camel@haggis

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: ron.l.johnson@cox.net
  Subject: Re: [HACKERS] Hypothetical suggestions for planner,
  In-Reply-To: <1052221755.3368.286.camel@haggis>
  References: <200305051219.58955.josh@agliodbs.com> <22292.1052195133@sss.pgh.pa.us> <1052221755.3368.286.camel@haggis>

* 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