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
Add PostGIS layers is too slow on connecting to a database #31160
Comments
Do you have the "use estimated table metadata" option enabled in your connection parameters? |
Yes, I have activated the options: |
Maybe a possibility to connect directly in DBManager without scanning the tables would solve the pb. |
@FERRATON, if I understand your issue correctly, I think that we cannot skip the scan for GEOMETRY tables (@jef-n correct me if I'm wrong), because they can contain different geometry types and/or SRIDs and we need to know them in order to extract the information about the tables. You are in principle right that it could be done only when actually necessary, but it would require a deep refactoring of the provider code and it would also bring some delay when that information is actually required, worsening the user experience. I would recommend to avoid GEOMETRY tables and use separate tables for different geometry types. |
I had understood not to use the GEOMETRY type. |
The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale". |
While we hate to see this happen, this Issue has been automatically closed because it has not had any activity in the last 42 days despite being marked as feedback. If this issue should be reconsidered, please follow the guidelines in the previous comment and reopen this issue. |
I stumbled on this trying to figure out why trying to connect to my postgis database is suddenly taking a very long time. QGIS is the only application I use where I regularly have to use force-quit/kill-9 and so on. I guess you can draw you own conclusions about that. The real answer here is anything that takes longer than 30 seconds or so should time out and give the user an option. Why are you not using async transactions? Very frustrating. |
Sometimes listing tables takes an almost an hour on this system. The sql sent to the database is this (I did format it here to make it more easy to read I used the original query on depesz links below.
This database have an very many table so on other smaller databases this is not a problem. Then it runs in a couple of seconds.
I have test with up 100 MB workmem and it's still slow. Test with 20 MB workmem trace here Test with 50 MB workmem trace here Test with 100 MB workmem trace here I also did a vacuum analyze this table list (some of them can not be vacuumed )
After 15 minutes I just broke this query running with 100 MB workmem.
I may test vacuum full later to night to check , that may work better, I think it has before. |
QGIS 3.4
I create a new ticket because I don't know how to reopen a ticket with github...
see #19639
It seems to me that QGIS always scans all tables when connecting (see attachment) which can be very slow.
in my case 20 minutes... it is impossible to stop the scan in the background, even if you close the dialog box or with the stop button.
(I have no geometry of the GEOMETRY type).
it is a remote server...(117 schemas of each a hundred tables).
The text was updated successfully, but these errors were encountered: