Re: View Index and UNION - Mailing list pgsql-hackers

From Tom Lane
Subject Re: View Index and UNION
Date
Msg-id 12969.1369580539@sss.pgh.pa.us
Whole thread Raw
In response to View Index and UNION  (Stefan Keller <sfkeller@gmail.com>)
Responses Re: View Index and UNION  (Stefan Keller <sfkeller@gmail.com>)
List pgsql-hackers
Stefan Keller <sfkeller@gmail.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



pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: Planning incompatibilities for Postgres 10.0
Next
From: Josh Berkus
Date:
Subject: Re: Planning incompatibilities for Postgres 10.0