Feature request #399
faster unique value dialogue for postgis layers
Status: | Closed | ||
---|---|---|---|
Priority: | Low | ||
Assignee: | Gavin Macaulay - | ||
Category: | Vectors | ||
Pull Request or Patch supplied: | Resolution: | fixed | |
Easy fix?: | No | Copied to github as #: | 10458 |
Description
For postgis layers the unique value dialogue could be made to be faster (i.e. determine the unique values for a given set of attributes quicker) if we use the database to do the work, currently the data is sorted and grouped by qgis in /src/gui/qgsuniquedialog.cpp. This may be good for non-postgis layers, but it would be faster if you passed a query to the server for a postgis layer.
Currently there is an array/list/variable called mClassBreakBox that is populated by code at about line 154 in aforementioned file or so it seems:
//go through all the features and insert their value into the map and into mClassBreakBox mClassBreakBox->clear(); while((f=provider->getNextFeature(attlist))) { vec = f->attributeMap(); value=vecr0.fieldValue(); if(mValues.find(value)==mValues.end()) { symbol=new [[QgsSymbol]](mVectorLayer->vectorType(), value); mValues.insert(std::make_pair(value,symbol)); } delete f; }
What would be good is something like this:
//go through all the features and insert their value into the map and into mClassBreakBox mClassBreakBox->clear(); **********postgis specific code********** IF layertype = postgis then mclassbreakbox = select attributecolumn from tablename group by attribute column; **********end postgis specific code************** else while((f=provider->getNextFeature(attlist))) { vec = f->attributeMap(); value=vecr0.fieldValue(); if(mValues.find(value)==mValues.end()) { symbol=new [[QgsSymbol]](mVectorLayer->vectorType(), value); mValues.insert(std::make_pair(value,symbol)); } delete f; }
using ~ 80000 records, postgresql took about 4 seconds to return all the unique values and qgis took about a minute.
Further, currently the unique value dialoge starts working on a column as soon as the uniqe value option is selected, maybe it would be better to not have it default to a specific column so that if the dataset is large the the user doesnt have to wait for it to finish going through one column especially if said column was not the intended column.
Associated revisions
- add getUniqueValues method to QgsVectorDataProvider
- implement getUniqueValues in QgsPostgresProvider (fixes #399)
- implement getUniqueValues, minValue and maxValue in OgsOgrProvider
- use getUniqueValues in QgsUniqueValueDialog
- update QgsPostgresProvider::storageType interface (fixes #995)
(applied patch from Steven Mizuno, thanks again)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8233 c8812cc2-4d05-0410-92ff-de0c093fc19c
- add getUniqueValues method to QgsVectorDataProvider
- implement getUniqueValues in QgsPostgresProvider (fixes #399)
- implement getUniqueValues, minValue and maxValue in OgsOgrProvider
- use getUniqueValues in QgsUniqueValueDialog
- update QgsPostgresProvider::storageType interface (fixes #995)
(applied patch from Steven Mizuno, thanks again)
git-svn-id: http://svn.osgeo.org/qgis/trunk@8233 c8812cc2-4d05-0410-92ff-de0c093fc19c
History
#1 Updated by Marco Hugentobler about 18 years ago
In my opinion this is more a usability bug and it should be fixed after 0.8 release.
Marco
#2 Updated by Gavin Macaulay - almost 17 years ago
- Status changed from Open to In Progress
#3 Updated by Jürgen Fischer over 16 years ago
- Resolution set to fixed
- Status changed from In Progress to Closed
implemented in
#4 Updated by Anonymous over 15 years ago
Milestone Version 0.9.2 deleted