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 20:27:56 -0400
Message-ID: <11984.1018657676@sss.pgh.pa.us> (raw)
In-Reply-To: <NEBBLAAHGLEEPCGOBHDGOECNEMAA.nickf@ontko.com>
References: <NEBBLAAHGLEEPCGOBHDGOECNEMAA.nickf@ontko.com>

"Nick Fankhauser" <nickf@ontko.com> writes:
>> You could
>> check by temporarily dropping the actor_case_assignment_both index and
>> seeing what plan you get.

> Here is the result:

> Index Scan using actor_upper_full_name on actor  (cost=0.00..1544484.16
> rows=3051 width=40)
>   SubPlan
>     ->  Nested Loop  (cost=0.00..21275.72 rows=42 width=24)
>           ->  Index Scan using actor_case_assignment_fk1 on
> actor_case_assignment  (cost=0.00..9221.62 rows=2696 width=12)
>           ->  Index Scan using case_data_case_id on case_data
> (cost=0.00..4.46 rows=1 width=12)

> Lightning-fast, but I need that index on both ids for other purposes.

Hmm.  If the outer side of the nestloop were actually hitting 2696 rows
on average, it wouldn't be "lightning fast".  So the planner's failure
to choose this plan is probably due to this overestimate.  You said you
were still on 7.1.*, right?  It'd be interesting to know if 7.2 gets
this right; it has more detailed stats and hopefully would make a better
estimate of the number of matches.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <11984.1018657676@sss.pgh.pa.us>
Permalink:  ../11984.1018657676@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11984.1018657676@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: <11984.1018657676@sss.pgh.pa.us>
  References: <NEBBLAAHGLEEPCGOBHDGOECNEMAA.nickf@ontko.com> <11984.1018657676@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