Opened 17 years ago

Closed 16 years ago

Last modified 15 years ago

#399 closed enhancement (fixed)

faster unique value dialogue for postgis layers

Reported by: rhys.stewart@… 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 mhugent, 17 years ago

Milestone: Version 0.8 ReleaseVersion 0.9 Release
Must Fix for Release: YesNo

comment:2 by mhugent, 17 years ago

In my opinion this is more a usability bug and it should be fixed after 0.8 release.

Marco

comment:3 by g_j_m, 16 years ago

Awaiting user input: unset
Status: newassigned

comment:4 by jef, 16 years ago

Resolution: fixed
Status: assignedclosed

implemented in r8233

comment:5 by (none), 15 years ago

Milestone: Version 0.9.2

Milestone Version 0.9.2 deleted

Note: See TracTickets for help on using tickets.