Bug report #14629

Select by expression (Not Responding)

Added by Nikos Tsarmpopoulos about 4 years ago. Updated almost 4 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Affected QGIS version:2.14.0 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:not reproducable
Crashes QGIS or corrupts data:Yes Copied to github as #:22594

Description

Hi. I've noticed that Select by expression freezes when working with a large dataset (e.g. postcodes database). I trust the process will theoretically unfreeze once the query has been executed, long queries should be executed in a separate thread and the user interface should provide a button to interrupt it. This is because it is not always possible to predict how long a particular query may take to be evaluated/executed and, where it is found to be too slow, it makes more sense interrupting it and opting for an alternative approach. Currently, once it's frozen, the only option is to kill the whole of QGIS, potentially loosing the current version of the project.

Applies to QGIS 2.14.1 64bit on Windows 7 Pro 64bit.

History

#1 Updated by Nyall Dawson about 4 years ago

  • Status changed from Open to Feedback

What data source are you using? What's the expression used?

#2 Updated by Nikos Tsarmpopoulos about 4 years ago

A SHP file containing some millions of postcodes. The expression is in the form of "<column_name>"='<value>'. The dataset is known to contain a row with this particular alphanumeric <value> in the particular <column_name>.

#3 Updated by Nyall Dawson about 4 years ago

Two suggestions which may help:

1. Make sure Settings -> Options -> Data Sources -> "Execute expressions on server side" is checked
2. Create an attribute index on the postcode field. You can do this via the command line ogrinfo tool:

ogrinfo -sql "CREATE INDEX ON postcode_file USING postcode_field" postcode_file.shp

where postcode_file is the name of your shape file and postcode_field the field you are searching on.

#4 Updated by Nikos Tsarmpopoulos about 4 years ago

Nyall Dawson wrote:

Two suggestions which may help:

1. Make sure Settings -> Options -> Data Sources -> "Execute expressions on server side" is checked
2. Create an attribute index on the postcode field. You can do this via the command line ogrinfo tool:

ogrinfo -sql "CREATE INDEX ON postcode_file USING postcode_field" postcode_file.shp

where postcode_file is the name of your shape file and postcode_field the field you are searching on.

Thanks for the advice. I think I've already selected "Execute expressions on server side". I presume "server side" refers to the SQL engine, right? Also, creating an index is crucial for searching in large datasets but I don't have access to the command line, as it's locked by group policy. I'll try to find an alternative way to execute the SQL command, if possible.

#5 Updated by Giovanni Manghi almost 4 years ago

  • Category set to Vectors

Nikos Tsarmpopoulos wrote:

Nyall Dawson wrote:

Two suggestions which may help:

1. Make sure Settings -> Options -> Data Sources -> "Execute expressions on server side" is checked
2. Create an attribute index on the postcode field. You can do this via the command line ogrinfo tool:

ogrinfo -sql "CREATE INDEX ON postcode_file USING postcode_field" postcode_file.shp

where postcode_file is the name of your shape file and postcode_field the field you are searching on.

Thanks for the advice. I think I've already selected "Execute expressions on server side". I presume "server side" refers to the SQL engine, right? Also, creating an index is crucial for searching in large datasets but I don't have access to the command line, as it's locked by group policy. I'll try to find an alternative way to execute the SQL command, if possible.

you can create the spatial index of a shape from the qgis gui, vector properties, general tab.

#6 Updated by Giovanni Manghi almost 4 years ago

have you tested after creating the index?

#7 Updated by Giovanni Manghi almost 4 years ago

  • Resolution set to not reproducable
  • Status changed from Feedback to Closed

Closing for lack of feedback, please reopen if necessary.

Also available in: Atom PDF