Opened 7 years ago

Last modified 7 years ago

#3864 closed defect

Sorting by geometry is slower than sorting by geohash — at Version 2

Reported by: komzpa Owned by: pramsey
Priority: medium Milestone: PostGIS 2.4.1
Component: postgis Version: 2.3.x
Keywords: Cc:

Description (last modified by pramsey)

[local] gis@gis=# create table juno_osm_point_unclustered as (select * from juno_osm_point ORDER BY osm_id);
SELECT 159446335
Time: 601714,217 ms (10:01,714)

[local] gis@gis=# create table juno_osm_point_pt1 as (select * from juno_osm_point_unclustered ORDER BY ST_GeoHash(ST_Transform(ST_Envelope(way),4326),10) COLLATE "C");
SELECT 159446335
Time: 1248105,490 ms (20:48,105)
[local] gis@gis=# create table juno_osm_point_pt2 as (select * from juno_osm_point_unclustered ORDER BY way);
SELECT 159446335
Time: 1287415,365 ms (21:27,415)

This may happen as there are some other infrastructure optimizations in string sorting code, like abbreviated key comparsions.

Change History (2)

comment:1 by robe, 7 years ago

Which version of PostGIS is this?

SELECT postgis_full_version();

You have it marked as 2.3, but just want to make sure it really is 2.3 and not 2.4. Since pramsey changed the sort behavior in 2.4

comment:2 by pramsey, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.