[QGIS-trac] [Quantum GIS] #3453: Postgis layer load starts out with unnecessarily expensive query

Quantum GIS qgis at qgis.org
Sun Jan 30 11:22:29 EST 2011


#3453: Postgis layer load starts out with unnecessarily expensive query
------------------------------------------------+---------------------------
   Reporter:  arencambre                        |              Owner:  nobody       
       Type:  bug                               |             Status:  new          
   Priority:  major: does not work as expected  |          Milestone:  Version 1.7.0
  Component:  Data Provider                     |            Version:  1.6.0        
   Keywords:                                    |   Platform_version:  7            
   Platform:  Debian                            |           Must_fix:  No           
Status_info:  0                                 |  
------------------------------------------------+---------------------------
 Postgis layer loads start out with this query:

 {{{ select distinct case when geometrytype("the_geom") IN
 ('POINT','MULTIPOINT') THEN 'POINT' when geometrytype("the_geom") IN
 ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING' when
 geometrytype("the_geom") IN ('POLYGON','MULTIPOLYGON') THEN 'POLYGON' end
 from [databaseGoesHere] }}}

 I think this is needlessly expensive for my 12,000,000 row Postgis dataset
 for two reasons:

  * DISTINCT isn't necessary because my dataset has no duplicates even
 though some rows may have identical locations. Do GIS datasets routinely
 have duplicate data? At least let me override DISTINCT before loading
 large datasets. I am now worried that other datasets may have had objects
 missed that had identical locations.
  * Not sure why each geometry object is being checked for geometry type.
 QGIS knows the geometry type before the Postgis layer is even loaded
 thanks to the '''geometry_columns''' table.

-- 
Ticket URL: <http://trac.osgeo.org/qgis/ticket/3453>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list