Re: [PERFORM] partition query using Seq Scan even when index is present

2009-09-03 Thread Kenneth Cox
Thank you, Greg! I tweaked your function to use recursion to search all inherited tables; my inheritance structure is two levels deep. This function is for integers only; I will copy/waste to create one for timestamps. Extra credit for anyone who can rewrite it to be polymorphic. -- Same

Re: [PERFORM] partition query using Seq Scan even when index is present

2009-09-03 Thread Merlin Moncure
On Wed, Sep 2, 2009 at 4:15 PM, Kenneth Cox wrote: > With postgresql-8.3.6, I have many partitions inheriting a table.  SELECT > min() on the parent performs a Seq Scan, but SELECT min() on a child uses > the index.  Is this another case where the planner is not aware enough to > come up with the b

Re: [PERFORM] partition query using Seq Scan even when index is present

2009-09-02 Thread Greg Jaman
Yep I ran into the exact same problem. My solution was to create a pl/pgsql function to query the child tables: ( http://archives.postgresql.org/pgsql-performance/2008-11/msg00284.php) If you find a better solution please share. -Greg Jaman On Wed, Sep 2, 2009 at 1:15 PM, Kenneth Cox wrote:

[PERFORM] partition query using Seq Scan even when index is present

2009-09-02 Thread Kenneth Cox
With postgresql-8.3.6, I have many partitions inheriting a table. SELECT min() on the parent performs a Seq Scan, but SELECT min() on a child uses the index. Is this another case where the planner is not aware enough to come up with the best plan? I tried creating an index on the parent ta