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

Add database indexes in schema files. #411

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ CREATE TABLE IF NOT EXISTS EVENT_PUBLICATION
PUBLICATION_DATE TIMESTAMP(9) WITH TIME ZONE NOT NULL,
SERIALIZED_EVENT VARCHAR(4000) NOT NULL,
PRIMARY KEY (ID)
)
);
CREATE INDEX IF NOT EXISTS EVENT_PUBLICATION_LISTENER_ID_SERIALIZED_EVENT_IDX ON EVENT_PUBLICATION (LISTENER_ID, SERIALIZED_EVENT);
CREATE INDEX IF NOT EXISTS EVENT_PUBLICATION_COMPLETION_DATE_IDX ON EVENT_PUBLICATION (COMPLETION_DATE);
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ CREATE TABLE IF NOT EXISTS EVENT_PUBLICATION
SERIALIZED_EVENT VARCHAR(4000) NOT NULL,
PUBLICATION_DATE TIMESTAMP(6) NOT NULL,
COMPLETION_DATE TIMESTAMP(6) DEFAULT NULL NULL,
PRIMARY KEY (ID)
)
PRIMARY KEY (ID),
INDEX EVENT_PUBLICATION_LISTENER_ID_IDX (LISTENER_ID),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

SERIALIZED_EVENT cannot be a part of index key as MySQL accepts only 3072 bytes.

INDEX EVENT_PUBLICATION_COMPLETION_DATE_IDX (COMPLETION_DATE)
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ CREATE TABLE IF NOT EXISTS event_publication
publication_date TIMESTAMP WITH TIME ZONE NOT NULL,
completion_date TIMESTAMP WITH TIME ZONE,
PRIMARY KEY (id)
)
);
CREATE INDEX IF NOT EXISTS event_publication_listener_id_serialized_event_idx ON event_publication (listener_id, serialized_event);
CREATE INDEX IF NOT EXISTS event_publication_completion_date_idx ON event_publication (completion_date);