Re: Postgresql 8.1.4 - performance issues for select on view using max - Mailing list pgsql-performance

From Ioana Danes
Subject Re: Postgresql 8.1.4 - performance issues for select on view using max
Date
Msg-id 20061019112357.66833.qmail@web55908.mail.re3.yahoo.com
Whole thread Raw
In response to Re: Postgresql 8.1.4 - performance issues for select on  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-performance
Hello,

Actually what I expected from the planner for this
query (select max(transid) from view) was something
like this :

select max(transid) from (select max(transid) from
archive.transaction union all select max(transid) from
public.transaction)

and to apply the max function to each query of the
union. This is what is happening when you use a where
condition, it is using the indexes on each subquery of
the view...
ex: select transid from view where transid = 12;

This way it would be fast enough.

Also for order by and limit I was expecting the same
thing.


Thank you for your time,
Ioana Danes

> constraint exclusion and inheritance won't help him.
>
> The problem is that he has two indexes, and he needs
> to find the max
> between both of them. PostgreSQL isn't smart enough
> to recognize that it
> can use two indexes, find the max in each one, and
> find the max of those
> two values.
>
> Regards,
>     Jeff Davis
>
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

pgsql-performance by date:

Previous
From: Mark Kirkwood
Date:
Subject: Re: measuring shared memory usage on Windows
Next
From: Ioana Danes
Date:
Subject: Re: Postgresql 8.1.4 - performance issues for select on