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

[postgres] Fix superslow layer instantiation in huge databases by only fetching type info of used fields. #38158

Merged

Conversation

borysiasty
Copy link
Member

If a postgresql database contains hundreds of thousands tables, instantiating any layer becomes madly slow, because QgsPostgresProvider::loadFields fetches type info for all those tables, instead of just columns of source table(s). See bug #38114.

This PR adds a filter to only fetch used columns, speeding up project opening in my case from over one hour (!) to a couple of seconds.

Supersedes #38115.

@borysiasty borysiasty added Data Provider Related to specific vector, raster or mesh data providers Bug Either a bug report, or a bug fix. Let's hope for the latter! labels Aug 5, 2020
@borysiasty borysiasty changed the title [postgres] Fix superslow layer instantiation with huge databases by only fetching type info of used fields. [postgres] Fix superslow layer instantiation in huge databases by only fetching type info of used fields. Aug 5, 2020
@github-actions github-actions bot added this to the 3.16.0 milestone Aug 5, 2020
@nyalldawson
Copy link
Collaborator

Looks great, thanks!

Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
src/providers/postgres/qgspostgresprovider.cpp Outdated Show resolved Hide resolved
src/providers/postgres/qgspostgresprovider.cpp Outdated Show resolved Hide resolved
src/providers/postgres/qgspostgresprovider.cpp Outdated Show resolved Hide resolved
src/providers/postgres/qgspostgresprovider.cpp Outdated Show resolved Hide resolved
@borysiasty
Copy link
Member Author

The failed Azure build doesn't look related.

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! Data Provider Related to specific vector, raster or mesh data providers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants