Re: inheritance: planning time vs children number vs column number

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marc Cousin <cousinmarc(at)gmail(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: inheritance: planning time vs children number vs column number
Date: 2011-03-01 17:33:54
Message-ID: 22075.1299000834@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I wrote:
> Marc Cousin <cousinmarc(at)gmail(dot)com> writes:
>> Yes, for the same test case, with a bit of data in every partition and
>> statistics up to date, planning time goes from 20 seconds to 125ms for the 600
>> children/1000 columns case. Which is of course more than acceptable.

> [ scratches head ... ] Actually, I was expecting the runtime to go up
> not down. Maybe there's something else strange going on here.

Oh, doh: the failing pg_statistic lookups are all coming from the part
of estimate_rel_size() where it tries to induce a reasonable tuple width
estimate for an empty table (see get_rel_data_width). Probably not a
case we need to get really tense about. Of course, you could also argue
that this code is stupid because it's very unlikely that there will be
any pg_statistic entries either. Maybe we should just have it go
directly to the datatype-based estimate instead of making a boatload
of useless pg_statistic probes.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message sverhagen 2011-03-02 00:14:15 Performance trouble finding records through related records
Previous Message Maciek Sakrejda 2011-03-01 17:07:18 Re: Two different execution plans for similar requests