pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: nickf@ontko.com
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: A *short* planner question
Date: Fri, 12 Apr 2002 18:29:46 -0400
Message-ID: <11224.1018650586@sss.pgh.pa.us> (raw)
In-Reply-To: <NEBBLAAHGLEEPCGOBHDGMECJEMAA.nickf@ontko.com>
References: <NEBBLAAHGLEEPCGOBHDGMECJEMAA.nickf@ontko.com>

"Nick Fankhauser" <nickf@ontko.com> writes:
> So... why wouldn't the planner do this:

Offhand I think the planner should have considered that plan; evidently
it thought it was more expensive than this plan.  (Perhaps it was right;
how selective is the actor_case_assignment(actor_id) index?)  You could
check by temporarily dropping the actor_case_assignment_both index and
seeing what plan you get.  You don't even have to really drop it; try

	begin;
	drop index ...;
	explain ...;
	rollback;

Should work, without the pain of rebuilding the index afterwards...

> Another thing that doesn't make sense to me, but doesn't hurt the plan, is
> that although we have analyze stats on actor, the planner seems to be using
> the default of .01 on upper(actor_full_name) and predicts that 2799 rows
> will be returned, however, if I get rid of the upper(), it uses the stats
> and predicts that 1 row will be returned. Does the use of an index on a
> function make the planner stop using the stats?

There are no stats computed for the values of functional indexes, at
present, thus no way for the planner to derive any realistic estimate for
the selectivity of that clause.  I have a private TODO item about that,
but I'm not sure if the public TODO list mentions it.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <11224.1018650586@sss.pgh.pa.us>
Permalink:  ../11224.1018650586@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11224.1018650586@sss.pgh.pa.us

 · 

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-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nickf@ontko.com
  Subject: Re: A *short* planner question
  In-Reply-To: <11224.1018650586@sss.pgh.pa.us>
  References: <NEBBLAAHGLEEPCGOBHDGMECJEMAA.nickf@ontko.com> <11224.1018650586@sss.pgh.pa.us>

* 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