Re: Partitioned tables - planner wont use indexes

From: PFC <lists(at)peufeu(dot)com>
To: "kevin kempter" <kevin(at)kevinkempterllc(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Partitioned tables - planner wont use indexes
Date: 2008-04-11 10:41:15
Message-ID: op.t9fzy1lncigqcu@apollo13.peufeu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


> I tried removing the index from the part_master table and got the same
> result

Since all the data is in the partitions, the part_master table is empty,
so the index is not useful for your query.

> myDB=# explain SELECT min(logdate) FROM part_master;

Proposals :

1- Use plpgsql to parse the system catalogs, get the list of partitions,
and issue a min() query against each
2- Since dates tend to be incrementing, I guess the minimum date must not
be changing that often (unless you delete rows) ; therefore if you need
that information often I suggest a trigger that updates a separate table
which keeps the min_date (perhaps global or for each client, you choose).

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Albe Laurenz 2008-04-11 11:22:04 Performance increase with elevator=deadline
Previous Message Craig Ringer 2008-04-11 07:23:36 Re: Views and functions returning sets of records