Sebastian,
> I'm having another problem with a query that takes to long, because
> the appropriate index is not used.
PostgreSQL is not currently able to push down join criteria into UNIONed
subselects. It's a TODO.
Also, if you're using inherited tables, it's unnecessary to use UNION; just
select from the parent.
--
Josh Berkus
Aglio Database Solutions
San Francisco