pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Dutcher <dave@tridecap.com>
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Bad Row Count Estimate on View with 8.2
Date: Tue, 30 Jan 2007 08:54:33 -0600
Message-ID: <00d501c7447e$8e227760$8300a8c0@tridecap.com> (raw)
In-Reply-To: <17556.1170010078@sss.pgh.pa.us>

> From: pgsql-performance-owner@postgresql.org 
> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Tom Lane
> 
> I took another look and think I found the problem: 8.2's new code for
> flattening UNION ALL subqueries into "append relations" is failing to
> initialize all the fields of the appendrel, which confuses
> estimate_num_groups (and perhaps other places).  I think this will fix
> it for you.
> 

I gave this a try on our test machine yesterday and it worked.  The planner
was estimating that the group by on the union would return about 300 rows
which is very similar to what 8.1.2 thought.  Actually it returned about
3000 rows, but still it is a good enough estimate to pick a plan which takes
100ms instead of a plan which takes 100 seconds.

Thanks,

Dave





view thread (5+ messages)

Message-ID: <00d501c7447e$8e227760$8300a8c0@tridecap.com>
Permalink:  ../00d501c7447e$8e227760$8300a8c0@tridecap.com/
Also on:    postgresql.org/message-id/00d501c7447e$8e227760$8300a8c0@tridecap.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dave@tridecap.com, tgl@sss.pgh.pa.us
  Subject: Re: Bad Row Count Estimate on View with 8.2
  In-Reply-To: <00d501c7447e$8e227760$8300a8c0@tridecap.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