#399 closed enhancement (fixed)
faster unique value dialogue for postgis layers
Reported by: | Owned by: | g_j_m | |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | |
Component: | Vectors | Version: | Trunk |
Keywords: | postgis | Cc: | |
Must Fix for Release: | No | Platform: | All |
Platform Version: | Awaiting user input: | no |
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=vec[0].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=vec[0].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.
Change History (5)
comment:1 by , 16 years ago
Milestone: | Version 0.8 Release → Version 0.9 Release |
---|---|
Must Fix for Release: | Yes → No |
comment:2 by , 16 years ago
comment:3 by , 15 years ago
Awaiting user input: | unset |
---|---|
Status: | new → assigned |
In my opinion this is more a usability bug and it should be fixed after 0.8 release.
Marco