-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Feature creation very slow when using joins #36167
Comments
@Alexandre27 is the join created in QGIS or at a DB level? |
@gioman I'm working on this with @Alexandre27, the join is created on QGIS. The script that we sent above creates some sample data with this command:
The specific data does not seem to be important, just the amount of data (for us 15k seems to make the problem obvious). We don't need any data on the attribute_layer to see the slowness happen. If you wish we can still send you a full dump. |
@Alexandre27 @nulopes Olá,
if it doesn't bore too much, yes I would prefer to have the dump of both tables. Also another question: does the problem only occur with PostGIS data? What about file based data? Do you see the same issue? |
@Alexandre27 viva, I tested on master on Ubuntu 18.04 and I see the same issue. Any idea if this regressed at some point in the past (i.e. do you know if in previous releases this was not an issue?)? |
@gioman Olá,
We tested with 3.4 and 3.8 and had the same results, should we go even further back? |
testing the last LTR of the 2.* series (2.18) would also be very useful. What we need to understand if this is a regression as it would get more attention during bug fixing campaigns. |
I've now tested with 2.18 and it's instantaneous, so this seems to be a regression. |
@nulopes thanks, hopefully it will be fixed in the next round of bug fixing. |
@gioman thanks, If I can help anymore (even if it implies some debugging), please let me know |
@nulopes thanks! the project is open in every sense, so you are most welcome to jump in with debugging, patches, requests for commercial support for targeted bug fixes (see the proper page on the qgis.org site), etc. |
I've been able to reproduce the issue, it's not a trivial fix though. |
@elpaso I had the feeling it wouldn't be. I have already setup an environment and compiled qgis from source but with such a large project I don't know where to start. Do you think I can help and lay some ground for the fix? I haven't programmed in C++ for 2 years now, but I'd be glad to help. |
Thank you @nulopes, but I've already spent some time on this issue, if you are willing to help I would recommend that you start with something easier, there are plenty of bugs in the issue queue, just pick one that you feel comfortable with, assign it to you and give it a try. |
Unique constraint validation was sub-optimized in several points, this PR addresses a few of the critical paths all in QgsVectorLayerUtils - in createFeatures: on-demand creation of the cached values - in validateAttribute: don't check for uniqueness if the value is NULL and a NOT NULL constraint was violated - in valueExists: search source layers for values in joined fields Fixes qgis#36167
Describe the bug
When creating features on a layer that has vector joins, qgis takes more than 40 seconds (with form opening enabled) and 10s (hiding form) with a point layer with 15k features with a postgresql source on localhost. This makes qgis edition unusable when there are a large number of features (60k on a real dataset).
How to Reproduce
Create a postgis database using the following commands:
Create a feature on point_layer using the attached qgis project (which assumes that the db is running on port 5432 on localhost with user postgis and password postgis). In this project the join is already made.
This should take a long time to complete.
QGIS and OS versions
Additional context
When trying to find out what the problem was I noticed that qgis makes a lot of repeated queries when doing a feature creation. This seems to cause the delay as it gets completely unusable when connecting to a remote postgres db.
Here is the queries made on a single feature creation with the form enabled.
This problem was already submitted on stack exchange and qgis-users mailing list.
The text was updated successfully, but these errors were encountered: