Hello, It looks like some of you missed my first email but my problem is not to find a replacement for this select: select max(transid) from someunionview Thare are plenty of solutions for doing this... My point is to split a tale in two and to make this transparent for the developers as a first step. On the second step they will improve some of the queries but that is another story. So I would like to know if there is any plan to improve this type of query for views in the near future, or maybe it is alredy improved in 8.2 version? I have the same problem and question for: select transid from someunionview order by transid desc limit 1; Thank you for your time, Ioana Danes --- Tom Lane <tgl@xxxxxxxxxxxxx> wrote: > Jeff Davis <pgsql@xxxxxxxxxxx> writes: > > If PostgreSQL could sort the result of a union by > merging the results of > > two index scans, I think the problem would be > solved. Is there something > > preventing this, or is it just something that > needs to be added to the > > planner? > > It's something on the wish-list. Personally I'd be > inclined to try to > rewrite the query as a plain MAX() across rewritten > per-table indexed > queries, rather than worry about mergesort or > anything like that. > There wasn't any very good way to incorporate that > idea when planagg.c > was first written, but now that the planner has an > explicit notion of > "append relations" it might be relatively > straightforward. > > regards, tom lane > > ---------------------------(end of > broadcast)--------------------------- > TIP 6: explain analyze is your friend > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com