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