Gaetano, > I did in that way just to not use postgresql specific feature. > I can give it a try and I let you know, however the question remain, > why the index usage is lost if used in that way ?
Because PostgreSQL is materializing the entire UNION data set in the subselect. What Postgres version are you using? I thought this was fixed in 7.4, but maybe not ... -- Josh Berkus Aglio Database Solutions San Francisco ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org