Repository navigation
chore: Align DocType indexes with their queries - #45
Merged
Merged
Conversation
Drop unique indexes on fields that DocTypes are named by, since they copy the primary key. Replace single-column indexes on DNS Record, DMARC Report, TLS Report and Tenant Email with the composites their queries filter and sort on, and drop the unused DMARC Report Record source_ip index. Index Suite Site by region and status so the pool claim locks only its region's ready sites, and index the status and tenant lookups that the signup and alert crons scan. Enforce a unique cluster label per DNS zone in the database as well as in validation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
(dns_zone, host), DMARC and TLS Report(tenant, date_range_end), Tenant Email(tenant, sent_at). Drop the unused DMARC Report Recordsource_ipindex.(region, status)andstatus. The pool claim (FOR UPDATE SKIP LOCKED) then locks only its region's ready sites, and the site crons do not scan the table.tenantandstatus, and Telemetry Alertstatusand(host_ip, alert_type), for the signup, expiry, resume and alert lookups.(dns_zone, label)constraint to Stalwart Cluster. Validation already enforced this rule; the database now enforces it too.Test plan
migrateran clean, andSHOW INDEXgives the expected layout on each changed table.suite_cloud/tests/test_indexes.pychecks the expected indexes and that name fields have no second index.run-tests --app suite_cloud: all 468 tests pass.ruff checkandruff format --checkpass.