pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sean Chittenden <sean@chittenden.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgreSQL.org
Cc: pgsql-performance@postgreSQL.org
Subject: Re: [PERFORM] Proposal: relaxing link between explicit JOINs and execution order
Date: Wed, 22 Jan 2003 15:59:31 -0800
Message-ID: <20030122235931.GE12075@perrin.int.nxad.com> (raw)
In-Reply-To: <25071.1043276513@sss.pgh.pa.us>
References: <25071.1043276513@sss.pgh.pa.us>

> There's been some recent discussion about the fact that Postgres
> treats explicit JOIN syntax as constraining the actual join plan, cf
> http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/explicit-joins.html
> 
> This behavior was originally in there simply because of lack of time
> to consider alternatives.  I now realize that it wouldn't be hard to
> get the planner to do better --- basically, preprocess_jointree just
> has to be willing to fold JoinExpr-under-JoinExpr into a FromExpr
> when the joins are inner joins.
> 
> But in the meantime, some folks have found the present behavior to be
> a feature rather than a bug, since it lets them control planning time
> on many-table queries.  If we are going to change it, I think we need
> some way to accommodate both camps.
[snip]
> Comments?  In particular, can anyone think of pithy names for these
> variables?  The best I'd been able to come up with is
> MAX_JOIN_COLLAPSE and MAX_FROM_COLLAPSE, but neither of these
> exactly sing...

How about something that's runtime tunable via a SET/SHOW config var?
There are some queries that I have that I haven't spent any time
tuning and would love to have the planner spend its CPU thinking about
it instead of mine.  Setting it to 2 by default, then on my tuned
queries, setting to something obscenely high so the planner won't muck
with what I know is fastest (or so I think at least).

I know this is a can of worms, but what about piggy backing on an
Oracle notation and having an inline way of setting this inside of a
comment?

SELECT /* +planner:collapse_tables=12  */ ....  ?
           ^^^^^^^ ^^^^^^^^^^^^^^^ ^^^
	   system  variable        value

::shrug::  In brainstorm mode.  Anyway, a few names:

auto_order_join
auto_order_join_max
auto_reorder_table_limit
auto_collapse_join
auto_collapse_num_join
auto_join_threshold

When I'm thinking about what this variable will do for me as a DBA, I
think it will make the plan more intelligent by reordering the joins.
My $0.02.  -sc

-- 
Sean Chittenden



view thread (6+ messages)  latest in thread

Message-ID: <20030122235931.GE12075@perrin.int.nxad.com>
Permalink:  ../20030122235931.GE12075@perrin.int.nxad.com/
Also on:    postgresql.org/message-id/20030122235931.GE12075@perrin.int.nxad.com

 · 

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: sean@chittenden.org, tgl@sss.pgh.pa.us, pgsql-hackers@postgreSQL.org
  Subject: Re: [PERFORM] Proposal: relaxing link between explicit JOINs and execution order
  In-Reply-To: <20030122235931.GE12075@perrin.int.nxad.com>
  References: <25071.1043276513@sss.pgh.pa.us> <20030122235931.GE12075@perrin.int.nxad.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