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

Update Set deletion query for improved performance. #1443

Closed
wants to merge 1 commit into from

Conversation

bri-gaia
Copy link

No description provided.

DELETE FROM ca_attribute_values WHERE attribute_id IN
(SELECT attribute_id FROM ca_attributes WHERE table_num=? and row_id IN (SELECT item_id FROM ca_set_items WHERE set_id = ?))
DELETE av.* FROM ca_attribute_values av JOIN ca_attributes a ON av.attribute_id = a.attribute_id
JOIN ca_set_items s on a.row_id = s.item_id WHERE a.table_num=? and s.set_id = ?
Copy link
Owner

Choose a reason for hiding this comment

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

If we're going to use a multi-table delete then perhaps we should delete both ca_attributes and ca_attribute_values in a single query?

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense. On it

Copy link
Author

Choose a reason for hiding this comment

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

@collectiveaccess ah, no we cannot do this in one statement because of the foreign key constraint. (at least not without a workaround that I don't feel comfortable doing.)

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

2 participants