pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joshua D. Drake <jd@commandprompt.com>
To: Sriram Dandapani <sdandapani@counterpane.com>
Cc: Pgsql-Performance (E-mail) <pgsql-performance@postgresql.org>
Subject: Re: select max(column) from parent table very slow
Date: Thu, 24 Aug 2006 18:08:49 -0700
Message-ID: <44EE4DA1.5060701@commandprompt.com> (raw)
In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF057500BF@ca-mail1.cis.local>
References: <6992E470F12A444BB787B5C937B9D4DF057500BF@ca-mail1.cis.local>

Sriram Dandapani wrote:
> Parent table has a column say column1 which is indexed (parent table and
> all child tables are indexed on that column)
> 

Do you mean?

select max(foo) from bar;

In older versions of postgresql that would scan the whole table. In 8.1 
and above it doesn't. However, I am guess that since this is a 
partitioned table the planner isn't smart enough to just perform the 
query on each child and a max on the set that is returned. Thus you are 
scanning each table completely.

But that is just a guess.

Joshua D. Drake


>  
> 
> When a select max(column1) is done on parent table..takes a very long
> time to get back with the result
> 
> The same query on a child table gives instantaneous response (the tables
> are quite large appx.each child table has about 20-30 million rows)
> 
>  
> 
> Constraint exclusion is turned on. The column is not the basis for
> partitioning. Postgres 8.1.2




-- 

    === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
    Providing the most comprehensive  PostgreSQL solutions since 1997
              http://www.commandprompt.com/





view thread (6+ messages)  latest in thread

Message-ID: <44EE4DA1.5060701@commandprompt.com>
Permalink:  ../44EE4DA1.5060701@commandprompt.com/
Also on:    postgresql.org/message-id/44EE4DA1.5060701@commandprompt.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: jd@commandprompt.com, sdandapani@counterpane.com
  Subject: Re: select max(column) from parent table very slow
  In-Reply-To: <44EE4DA1.5060701@commandprompt.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