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

Fixes #38171 - Add index on audit to speed up action queries and sorting for latest records #10426

Closed
wants to merge 1 commit into from

Conversation

sjha4
Copy link
Contributor

@sjha4 sjha4 commented Jan 29, 2025

Add an index to audit table that includes :auditable_type, :auditable_id, :action for quicker querying for particular action on a resource. Also added :created_at to make sorting quicker when we need to check newer records.
The index is specifically helpful for a usecase we have around fetching the latest sync audit record.

Katello/katello#11294

@sjha4
Copy link
Contributor Author

sjha4 commented Jan 31, 2025

Marked draft to work on reproducer steps to replicate the data that actually needs this index. Might close out if deemed unnecessary.

@sjha4
Copy link
Contributor Author

sjha4 commented Feb 10, 2025

In testing with different types of data, the actual product.last_sync_audit method I was ooking to speed up with this index doesn't actually use this index. I am able to get sql to use this index under very specific queries on different data sets. The original issue I was trying to fix doesn't need the index so will close this out.

@sjha4 sjha4 closed this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant