Skip site navigation (1) Skip section navigation (2)

Re: Bad Row Count Estimate on View with 8.2

From: "Dave Dutcher" <dave(at)tridecap(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Bad Row Count Estimate on View with 8.2
Date: 2007-01-30 14:54:33
Message-ID: 00d501c7447e$8e227760$8300a8c0@tridecap.com (view raw or flat)
Thread:
Lists: pgsql-performance
> From: pgsql-performance-owner(at)postgresql(dot)org 
> [mailto:pgsql-performance-owner(at)postgresql(dot)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



In response to

pgsql-performance by date

Next:From: Luke LonerganDate: 2007-01-30 14:56:57
Subject: Re: Querying distinct values from a large table
Previous:From: Brian HerlihyDate: 2007-01-30 14:38:11
Subject: Re: Querying distinct values from a large table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group