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

Optimize unique values checks in QgsVectorLayerUtils #36866

Merged
merged 2 commits into from
Jun 2, 2020

Conversation

elpaso
Copy link
Contributor

@elpaso elpaso commented Jun 1, 2020

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 #36167

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
@elpaso elpaso added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jun 1, 2020
@github-actions github-actions bot added this to the 3.14.0 milestone Jun 1, 2020
@elpaso elpaso merged commit ebc5995 into qgis:master Jun 2, 2020
@elpaso elpaso deleted the bugfix-gh36167-slow-creation-on-joins branch June 2, 2020 06:31
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!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature creation very slow when using joins
2 participants