Bug report #20270
Freeze when opening properties dialog on very large PostGIS layer
|Affected QGIS version:||3.4.1||Regression?:||Yes|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||28091|
In QGIS 3.4.0 on OSX I'm not able to open the properties dialog on a PostGIS vector layer. The app just freezes (but doesn't crash).
This only happens when I'm opening properties on a very large table (mine has 22 million rows). With a smaller table, it opens fine. Looking at pg_stat_activity on the database while QGIS is frozen, it looks like QGIS is running a 'SELECT COUNT FROM table;', which is known to perform really badly in Postgres on large table unfortunately.
I also left it to run for a few minutes and it does eventually open the properties dialog, which is another bit of evidence that it's because of this count query.
I'm not a postgres expert, but I've had a look into workarounds and unfortunately the only ones I can find involve modifying the count query rather than some config tweak in postgres, which makes it difficult for someone to workaround without a modification to QGIS.
I don't have this problem on the latest QGIS 2 and i think this was only introduced in the last couple of months since I think I had a working QGIS 3 at some point in the last few months. So i'm guessing something new has triggered a count where there wasn't one before.
This is my first bug report on QGIS, please let me know if I can provide any more info or run something to help diagnose.
#2 Updated by Antal Kosza almost 2 years ago
I can confirm this bug.
In my layer, there are approx. 3.5 million rows. Qgis did not finish in half an hour, but after killing the running query process, the properties dialog box appears instantly.
The same query (SELECT count (*) FROM tablename) with psql was 210 ms, according to the timing option. With ogrinfo ca. 500 ms.
My system is debian buster, with self build qgis, from up to date branch release_3_4.
QGIS verzió 3.4.1-Madeira
PostgreSQL 11.1 (Debian 11.1-1+b1)