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 DISTINCT only when required (service plan|offering list fetcher) #3651

Merged

Conversation

philippthun
Copy link
Member

@philippthun philippthun commented Feb 23, 2024

As part of PR #3620 it has been validated that there is no overlap between the different sources (UNIONed datasets). But as these single datasets are created by JOINing several tables, there might be duplicates depending on the cardinality of those relations. Thus the overall DISTINCT is replaced by DISTINCTs added when JOINing a table with a one-to-many relation. Calling .distinct multiple times does not have any negative effect as this simply sets a flag on the Sequel dataset.

This change should improve performance of requests to the following endpoints whenever those JOINs are not needed (e.g. depending on request parameters):

  • /v3/service_offerings
  • /v3/service_plans

Tests now ensure that there are:

  • multiple plans per offering
  • multiple service instances per plan
  • multiple visibilities per plan
  • multiple spaces per organization
  • 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

As part of PR cloudfoundry#3620 [1] it has been validated that there is no overlap
between the different sources (UNIONed datasets). But as these single
datasets are created by JOINing several tables, there might be
duplicates depending on the cardinality of those relations. Thus the
overall DISTINCT is replaced by DISTINCTs added when JOINing a table
with a one-to-many relation. Calling '.distinct' multiple times does not
have any negative effect as this simply sets a flag on the Sequel
dataset.

This change should improve performance of requests to the following
endpoints whenever those JOINs are not needed (e.g. depending on request
parameters):
- /v3/service_offerings
- /v3/service_plans

Tests now ensure that there are:
- multiple plans per offering
- multiple service instances per plan
- multiple visibilities per plan
- multiple spaces per organization

[1] cloudfoundry#3620
@philippthun philippthun marked this pull request as ready for review February 23, 2024 10:44
@philippthun philippthun changed the title Use DISTINCT only when required Use DISTINCT only when required (service plan|offering list fetcher) Feb 23, 2024
@philippthun philippthun marked this pull request as draft February 23, 2024 12:32
Copy link
Contributor

@johha johha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@philippthun philippthun marked this pull request as ready for review March 8, 2024 08:15
@philippthun philippthun merged commit 8018b60 into cloudfoundry:main Apr 16, 2024
8 checks passed
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.

2 participants