pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Anish Kejariwal <anishkej@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6112: heuristic for empty parent tables that are members of inheritance trees
Date: Mon, 11 Jul 2011 16:51:47 GMT
Message-ID: <201107111651.p6BGpluQ047958@wwwmaster.postgresql.org> (raw)


The following bug has been logged online:

Bug reference:      6112
Logged by:          Anish Kejariwal
Email address:      anishkej@gmail.com
PostgreSQL version: 9.0.3
Operating system:   Linux
Description:        heuristic for empty parent tables that are members of
inheritance trees
Details: 

Hello,

I'm filing this issue as a bug, and it seems like Tom Lane agrees that there
is a bug, and said: " maybe we should reconsider the heuristic for tables 
that are members of inheritance trees --- particularly parents of
inheritance trees."

All information is in:
http://archives.postgresql.org/pgsql-performance/2011-07/msg00063.php

Scenario:
-empty parent table
-all data is in child/partitioned tables

Bug:  
optimizer considers the parent table to be empty.  

Result: The execution plan is incorrect.  My particularly query took 25
seconds with the wrong execution plan, but 0.3 seconds with the correct
execution plan.

Work around:
Tom Lane suggested the following workaround to "defeat the empty-table
heuristic:
update pg_class set relpages = 1 where relname = 'icecream';

I'm using this work around for now, but I don't think this is acceptable. 
If someone were to accidentally run vacuum analyze on the parent table, then
the relpages will be set back to zero, and the query will run slowly.

Please let me know if you have any questions.

Anish



view thread (2+ messages)  latest in thread

Message-ID: <201107111651.p6BGpluQ047958@wwwmaster.postgresql.org>
Permalink:  ../201107111651.p6BGpluQ047958@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201107111651.p6BGpluQ047958@wwwmaster.postgresql.org

 · 

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-bugs@postgresql.org
  Cc: anishkej@gmail.com
  Subject: Re: BUG #6112: heuristic for empty parent tables that are members of inheritance trees
  In-Reply-To: <201107111651.p6BGpluQ047958@wwwmaster.postgresql.org>
  References: <201107111651.p6BGpluQ047958@wwwmaster.postgresql.org>

* 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