[postgis-users] use index for "order by xmin(geom)"

Melchior Moos melchior.moos at gmail.com
Wed May 16 14:10:01 PDT 2012


> "xmin" is actually a PostgreSQL system column used for transactions,
> not a PostGIS function.

Sorry, actually st_xmin is the function I'm after. I want to select
the whole table ordered by minimum x coordinate of the gemertries.
When I do it the naive way postgresql needs half an hour to prepare
the ordering before the first results are delivered, since my table is
quite large. I thought that it could be somehow possible to skip this
time since the ordering is already stored in the index on the geometry
column...

On 17 May 2012 03:05, Melchior Moos <melchior.moos at gmail.com> wrote:
> I recently read that postgis 2.0 can use the index in order by clauses
> to find nearest neighbours of geometries. Is there also a way to use
> the index for queries like
> SELECT * FROM xy ORDER BY xmin(geom); ?
> Best regards,
> Melchior Moos



More information about the postgis-users mailing list