From f8283fa6449acf7a1d7d19f90beeab3fef0e790d Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Tue, 21 May 2024 09:03:29 +0200 Subject: [PATCH] GH-519 - Improve Postgres default indexes. We now use a hash index for the serialized event to improve performance. --- .../src/main/resources/schema-postgresql.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-postgresql.sql b/spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-postgresql.sql index a8efb64b..df0b9f20 100644 --- a/spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-postgresql.sql +++ b/spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-postgresql.sql @@ -8,5 +8,5 @@ CREATE TABLE IF NOT EXISTS event_publication completion_date TIMESTAMP WITH TIME ZONE, PRIMARY KEY (id) ); -CREATE INDEX IF NOT EXISTS event_publication_by_listener_id_and_serialized_event_idx ON event_publication (listener_id, serialized_event); +CREATE INDEX IF NOT EXISTS event_publication_serialized_event_hash_idx ON event_publication USING hash(serialized_event); CREATE INDEX IF NOT EXISTS event_publication_by_completion_date_idx ON event_publication (completion_date);