Stefan Keller <sfkeller(at)gmail(dot)com> writes:
> Given following schema:
> 1. TABLE a and TABLE b, each with INDEX on attribute geom.
> 2. A VIEW with union:
> CREATE VIEW myview AS
> SELECT * FROM a
> UNION
> SELECT * FROM b;
> 3. And a simple query with KNN index and a coordinate "mypos" :
> SELECT * FROM myview
> ORDER BY ST_Geomfromtext(mypos) <-> myview.geom
I think this would work out-of-the-box in 9.1 or later, if you
made the view use UNION ALL instead of UNION.
regards, tom lane