[QGIS-trac] [Quantum GIS] #3451: Speed up Postgis view loading by remembering key

Quantum GIS qgis at qgis.org
Sat Jan 29 14:26:28 EST 2011


#3451: Speed up Postgis view loading by remembering key
------------------------------------------------+---------------------------
   Reporter:  arencambre                        |              Owner:  nobody       
       Type:  enhancement                       |             Status:  new          
   Priority:  major: does not work as expected  |          Milestone:  Version 1.7.0
  Component:  Project Loading / Saving          |            Version:  1.6.0        
   Keywords:                                    |   Platform_version:  7            
   Platform:  Windows                           |           Must_fix:  No           
Status_info:  0                                 |  
------------------------------------------------+---------------------------
 It appears that Postgres has no way of telling which column of a view is
 the key. Therefore, when QGIS loads a view, it tests candidate key columns
 until it finds one that satisfies this condition:

 {{{ select count(distinct "id")=count("id") ... }}}

 This is slow for large views, which are probably not uncommon in robust
 GIS applications. See http://forum.qgis.org/viewtopic.php?f=2&t=7014 for
 an example.

 The cost is we have to choose a "letter of two evils": deal with slow
 loading or convert views into tables.

 What if QGIS remembers the view's key in the project definition? Then the
 initial load penalty is only paid once in a project's life: the first time
 a view is loaded.

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/3451>
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