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

From: Ioana Danes <ioanasoftware(at)yahoo(dot)ca>
To: Jeff Davis <pgsql(at)j-davis(dot)com>, Dimitri Fontaine <dim(at)dalibo(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org, Ioana Danes <ioanasoftware(at)yahoo(dot)ca>
Subject: Re: Postgresql 8.1.4 - performance issues for select on view using max
Date: 2006-10-19 11:23:57
Message-ID: 20061019112357.66833.qmail@web55908.mail.re3.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Ioana Danes 2006-10-19 11:32:56 Re: Postgresql 8.1.4 - performance issues for select on
Previous Message Mark Kirkwood 2006-10-19 04:58:47 Re: measuring shared memory usage on Windows