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

Use foreign keys more to avoid DB queries #3033

Merged

Conversation

will-gant
Copy link
Contributor

@will-gant will-gant commented Oct 25, 2022

  • A short explanation of the proposed change:

This PR ensures that where an id or guid of an associated resource is present in a DB row we've already retrieved, we get that from memory instead of making a separate query to the table for the associated resource.

Many database tables contain foreign keys linking them to associated resources - for example, the processes table has an app_guid column, and the service_instances table has space_id.

process.app.guid = two queries
process.app_guid = one query

  • An explanation of the use cases your change solves

Optimization for speed

  • Links to any other associated PRs

n/a

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@will-gant will-gant marked this pull request as ready for review October 27, 2022 14:04
@will-gant will-gant force-pushed the avoid-unnecessary-queries branch from 10cba40 to 7522729 Compare October 27, 2022 14:07
@will-gant will-gant force-pushed the avoid-unnecessary-queries branch from 7522729 to ec5bf62 Compare October 28, 2022 14:53
@philippthun philippthun merged commit 6edaf8d into cloudfoundry:main Oct 31, 2022
@philippthun philippthun deleted the avoid-unnecessary-queries branch October 31, 2022 10:21
@philippthun philippthun restored the avoid-unnecessary-queries branch October 31, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants