From 8c82c3b536b5c12f79fd7af56ceec0dfb9a48bd9 Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Sat, 1 Jun 2024 09:58:08 +0200 Subject: [PATCH] add column to indexes --- .../db/migration/HTWO1_0_14__add_column_to_indexes.sql | 9 +++++++++ .../db/migration/V1_0_14__add_column_to_indexes.sql | 9 +++++++++ .../persistence/ForwardingEventJpaDto.java | 8 +++++++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 application/src/main/resources/db/migration/HTWO1_0_14__add_column_to_indexes.sql create mode 100644 application/src/main/resources/db/migration/V1_0_14__add_column_to_indexes.sql diff --git a/application/src/main/resources/db/migration/HTWO1_0_14__add_column_to_indexes.sql b/application/src/main/resources/db/migration/HTWO1_0_14__add_column_to_indexes.sql new file mode 100644 index 00000000..aba71c0c --- /dev/null +++ b/application/src/main/resources/db/migration/HTWO1_0_14__add_column_to_indexes.sql @@ -0,0 +1,9 @@ +drop index idxf6mchjaiqb65pytncc9l5fiw0; + +create index if not exists idxf6mchjaiqb65pytncc9l5fiw0 + on forwarding_events (channel_incoming, timestamp); + +drop index idx7ki7iilyupdjktdx80pd347au; + +create index if not exists idx7ki7iilyupdjktdx80pd347au + on forwarding_events (channel_outgoing, timestamp); \ No newline at end of file diff --git a/application/src/main/resources/db/migration/V1_0_14__add_column_to_indexes.sql b/application/src/main/resources/db/migration/V1_0_14__add_column_to_indexes.sql new file mode 100644 index 00000000..aba71c0c --- /dev/null +++ b/application/src/main/resources/db/migration/V1_0_14__add_column_to_indexes.sql @@ -0,0 +1,9 @@ +drop index idxf6mchjaiqb65pytncc9l5fiw0; + +create index if not exists idxf6mchjaiqb65pytncc9l5fiw0 + on forwarding_events (channel_incoming, timestamp); + +drop index idx7ki7iilyupdjktdx80pd347au; + +create index if not exists idx7ki7iilyupdjktdx80pd347au + on forwarding_events (channel_outgoing, timestamp); \ No newline at end of file diff --git a/forwarding-history/src/main/java/de/cotto/lndmanagej/forwardinghistory/persistence/ForwardingEventJpaDto.java b/forwarding-history/src/main/java/de/cotto/lndmanagej/forwardinghistory/persistence/ForwardingEventJpaDto.java index 72863695..0cd33ff8 100644 --- a/forwarding-history/src/main/java/de/cotto/lndmanagej/forwardinghistory/persistence/ForwardingEventJpaDto.java +++ b/forwarding-history/src/main/java/de/cotto/lndmanagej/forwardinghistory/persistence/ForwardingEventJpaDto.java @@ -14,7 +14,13 @@ @Entity @Table( name = "forwarding_events", - indexes = {@Index(columnList = "channelIncoming"), @Index(columnList = "channelOutgoing")} + indexes = {@Index( + name = "idxf6mchjaiqb65pytncc9l5fiw0", + columnList = "channelIncoming,timestamp" + ), @Index( + name = "idx7ki7iilyupdjktdx80pd347au", + columnList = "channelOutgoing,timestamp" + )} ) class ForwardingEventJpaDto { @Id