add tag indexes - #593
Open
pjfanning wants to merge 4 commits into
Open
Conversation
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.
Issue 1: Missing Tag-Leading Index on event_tag Table
Problem: The event_tag PK is (persistence_id, sequence_number, tag) — tag is the 3rd column. eventsByTag queries filter on tag first, so the PK index can't be used efficiently.
Fix: Added event_tag_idx index on the tag column across all 6 database dialects:
│ postgres/postgres-create-schema.sql │ CREATE INDEX CONCURRENTLY event_tag_idx on public.event_tag(tag) │
│ mysql/mysql-create-schema.sql │ CREATE INDEX event_tag_idx on event_tag (tag) │
│ mariadb/mariadb-create-schema.sql │ CREATE INDEX event_tag_idx on event_tag (tag) │
│ oracle/oracle-create-schema.sql │ CREATE INDEX EVENT_TAG_IDX ON EVENT_TAG (TAG) │
│ sqlserver/sqlserver-create-schema.sql │ CREATE INDEX event_tag_idx on event_tag (tag) │
│ h2/h2-create-schema.sql │ CREATE INDEX IF NOT EXISTS "event_tag_idx" on PUBLIC."event_tag" ("tag") │
Scala/Slick: Added val tagIdx = index(...) in JournalTables.scala:123
Migration scripts (for existing databases):
Issue 2: Missing global_offset Index in Oracle durable_state DDL
Problem: PostgreSQL, MySQL, MariaDB, H2, and SQL Server all had state_global_offset_idx — Oracle was the only dialect missing it.
Fix: