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 deletion of notes attached to subrecords #2292

Merged
merged 1 commit into from Jun 17, 2021

Conversation

quoideneuf
Copy link
Collaborator

Use the same Sequel optimization when removing subnote metadata from nested sub-records that have notes as is used for top-level records.

The resulting change in the SQL statements is as follows:
Before:
DELETE FROM subnote_metadata WHERE (note_id IN (SELECT id FROM note WHERE (rights_statement_id IN (27))))
After:
DELETE subnote_metadata FROM subnote_metadata INNER JOIN note ON (note.id = subnote_metadata.note_id) WHERE (rights_statement_id IN (27))

Related JIRA Ticket or GitHub Issue

#2275

How Has This Been Tested?

Wrote test coverage for updating records with sub records with notes.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have read the CONTRIBUTING document.
  • I have authority to submit this code.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@quoideneuf quoideneuf marked this pull request as ready for review June 15, 2021 19:34
@mark-cooper mark-cooper self-assigned this Jun 17, 2021
@mark-cooper mark-cooper merged commit ee74c7f into master Jun 17, 2021
@cdibella cdibella added this to the 3.1.0 milestone Aug 19, 2021
@quoideneuf quoideneuf deleted the subnote-metadata-issues branch March 30, 2022 20:41
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.

None yet

3 participants