Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting PostGIS layer in attribute view is extremely slow #16537

Closed
qgib opened this issue Apr 14, 2013 · 8 comments
Closed

Sorting PostGIS layer in attribute view is extremely slow #16537

qgib opened this issue Apr 14, 2013 · 8 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Apr 14, 2013

Author Name: Nyall Dawson (@nyalldawson)
Original Redmine Issue: 7609
Affected QGIS version: master
Redmine category:vectors


In current master sorting a PostGIS table by an attribute is very slow. The same table (containing ~ 1 million rows) exported to a shp file sorts in around 10 seconds, but the PostGIS version never finishes and endlessly spams the console with:

Debug: src/providers/postgres/qgspostgresconn.cpp: 804: (openCursor) Starting read-only transaction
Debug: src/providers/postgres/qgspostgresconn.cpp: 818: (closeCursor) Committing read-only transaction

@qgib
Copy link
Contributor Author

qgib commented Apr 14, 2013

Author Name: Pedro Venâncio (Pedro Venâncio)


I confirm, I notice quite a difference, even with layers much smaller than the Nyall.

But this only happens when I order a column for the 1st time, that is, clicking on a column header, it takes a long time to do the sorting. After this initial sorting, clicking on the same column to reverse the sort, the change is instantaneous.
Also, if I sort by another column, it continues to be fast.

Closing the attribute table and reopening, the slow pace of the 1st ordination happen again.

In 1.8 the ordering is always fast and, in my case, the database is on the machine where I have the QGIS master.

This seems limited to PostGIS, it does not happen with the same data in Spatialite or Shapefile.

@qgib
Copy link
Contributor Author

qgib commented Apr 14, 2013

Author Name: Giovanni Manghi (@gioman)


Pedro Venâncio wrote:

I confirm, I notice quite a difference, even with layers much smaller than the Nyall.

But this only happens when I order a column for the 1st time, that is, clicking on a column header, it takes a long time to do the sorting. After this initial sorting, clicking on the same column to reverse the sort, the change is instantaneous.
Also, if I sort by another column, it continues to be fast.

Closing the attribute table and reopening, the slow pace of the 1st ordination happen again.

In 1.8 the ordering is always fast and, in my case, the database is on the machine where I have the QGIS master.

This seems limited to PostGIS, it does not happen with the same data in Spatialite or Shapefile.

it should be a regression then.


  • category_id was configured as Vectors
  • priority_id was changed from Normal to Severe/Regression

@qgib
Copy link
Contributor Author

qgib commented Apr 16, 2013

Author Name: Regis Haubourg (@haubourg)


Tested in revision 268c037 , sorting attribute table in large postgis datasets leads to freeze and crash.
Same table as shapefile works OK (not real fast, but sufficient and stable)

@qgib
Copy link
Contributor Author

qgib commented Apr 18, 2013

Author Name: Matthias Kuhn (@m-kuhn)


Fixed in changeset "66fadee8ef4e1fb8863f62a61d25159f23c4eee6".


  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented Apr 19, 2013

Author Name: Regis Haubourg (@haubourg)


Hi Matthias,
since last revision, attribute show NULL values in attribute window, when identify is OK. It's true also fo shp this time. Do we reopen this ticket (it's probably related) ?

@qgib
Copy link
Contributor Author

qgib commented Apr 19, 2013

Author Name: Matthias Kuhn (@m-kuhn)


Hi Regis,

It should be already fixed on master.
I only noticed this morning, so the Windows nightly is probably buggy until tomorrow.

@qgib
Copy link
Contributor Author

qgib commented Apr 19, 2013

Author Name: Regis Haubourg (@haubourg)


OK thanks, let's see tomorrow then.

@qgib
Copy link
Contributor Author

qgib commented Apr 19, 2013

Author Name: Giovanni Manghi (@gioman)


regis Haubourg wrote:

OK thanks, let's see tomorrow then.

is this related?

#16569

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats) labels May 24, 2019
@qgib qgib added this to the Version 2.0.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant