As other posters have pointed out, you can overcome the ORDER BY/LIMIT restriction on UNIONs with parentheses. I think I misbalanced the parentheses in my original post, which would have caused an error if you just copied and pasted.
I don't think the limitation has to do with planning--just parsing the query.
pgsql-performance by date
|Next:||From: Tilmann Singer||Date: 2007-07-28 20:54:50|
|Subject: Re: Slow query with backwards index scan|
|Previous:||From: Bruno Rodrigues Siqueira||Date: 2007-07-28 20:12:10|
|Subject: RES: select on 1milion register = 6s|