Bug report #9429

slow selection of features

Added by Alvaro Huarte almost 11 years ago. Updated almost 11 years ago.

Status:Closed
Priority:High
Assignee:Alvaro Huarte
Category:Vectors
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:18023

Description

Any selection of features in QGIS calls to 'QgsVectorLayer::setSelectedFeatures' and from this commit (#39fab67e602aaa8be7e561a50b40ab7c38914258) it loads all featureIds even when none features were selected.

When the layer has many features, it is a big bottleneck!

I think that this verification is unneccesary in most of situations because of selections become from a 'QgsFeatureIterator fit = getFeatures(...)' calls.

I will propose that this verification be optional (disabled by default) and also it will ignore the unnecesary 'allFeatureIds()' call when none feature was selected.

History

#1 Updated by Alvaro Huarte almost 11 years ago

  • Affected QGIS version changed from 2.0.1 to master

#2 Updated by Nathan Woodrow almost 11 years ago

I agree the check is not needed. We have the ids and if they are not in the layer then they just don't get selected no need to check before hand.

Remove it.

#3 Updated by Alvaro Huarte almost 11 years ago

Nathan Woodrow wrote:

I agree the check is not needed. We have the ids and if they are not in the layer then they just don't get selected no need to check before hand.

Remove it.

Done:
https://github.com/qgis/QGIS/pull/1114

#4 Updated by Alvaro Huarte almost 11 years ago

  • Resolution set to fixed/implemented
  • Pull Request or Patch supplied changed from No to Yes

#5 Updated by Alvaro Huarte almost 11 years ago

  • Status changed from Open to Closed

#6 Updated by Alvaro Huarte almost 11 years ago

  • Status changed from Closed to Reopened

Reopened to enable ids validation in new optional parameter:

QgsVectorLayer::setSelectedFeatures( const QgsFeatureIds& ids, bool valdiateIds = false )

See:
https://github.com/qgis/QGIS/pull/1114#issuecomment-33346858

#7 Updated by Giovanni Manghi almost 11 years ago

  • Category changed from Browser to Vectors

Hi Alvaro, thanks for looking into this long standing and painful issue.

Does this

#9348

duplicates this ticket?

cheers!

#8 Updated by Alvaro Huarte almost 11 years ago

  • Status changed from Reopened to Resolved

#9 Updated by Alvaro Huarte almost 11 years ago

  • Status changed from Resolved to Closed

#10 Updated by Rhenriques Henriques almost 11 years ago

  • Status changed from Closed to Reopened

Be careful because this problem is not solved. Selection remains slow as before in the latest NB. Even with the modifications suggested by Alvaro from here "https://github.com/qgis/QGIS/pull/1116/files", the problem remains the same with huge databases.

These videos show the problem

http://www.dct.uminho.pt/smallsetselection.mp4

http://www.dct.uminho.pt/largesetselection.mp4

I'll wait for the next few days NB's to make further comments on developments.
I hope this gets fixed.

Cheers

#11 Updated by Alvaro Huarte almost 11 years ago

Rhenriques Henriques wrote:

Be careful because this problem is not solved. Selection remains slow as before in the latest NB. Even with the modifications suggested by Alvaro from here "https://github.com/qgis/QGIS/pull/1116/files", the problem remains the same with huge databases.

These videos show the problem

http://www.dct.uminho.pt/smallsetselection.mp4

http://www.dct.uminho.pt/largesetselection.mp4

I'll wait for the next few days NB's to make further comments on developments.
I hope this gets fixed.

Cheers

But this issue is about other use case.
I have not closed the issue #9348

#12 Updated by Giovanni Manghi almost 11 years ago

But this issue is about other use case.
I have not closed the issue #9348

the patch proposed has been merged and anyway it seems duplicate of #9348, or not? closing?

#13 Updated by Alvaro Huarte almost 11 years ago

I think so

#14 Updated by Giovanni Manghi almost 11 years ago

  • Status changed from Reopened to Closed

Also available in: Atom PDF