From d8ca3a5350423d3ef5b793cd754b59c306870e7f Mon Sep 17 00:00:00 2001
From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com>
Date: Mon, 18 Nov 2024 16:15:34 +0000
Subject: [PATCH] Added indexes for public_api_daily_limit table (#7140)
* Added indexes for public_api_daily_limit table
* Added the composite index for client_id ip_address and request_date
* fixed formatting
* added the indexes concurrently via liquibase
* Created separate changesets per index
* Added the dbms postgres
---
.../src/main/resources/db-master.xml | 1 +
...add_public_api_daily_rate_limit_indexes.xml | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
create mode 100644 orcid-persistence/src/main/resources/db/updates/add_public_api_daily_rate_limit_indexes.xml
diff --git a/orcid-persistence/src/main/resources/db-master.xml b/orcid-persistence/src/main/resources/db-master.xml
index a4a3b726fd..2d893fead1 100644
--- a/orcid-persistence/src/main/resources/db-master.xml
+++ b/orcid-persistence/src/main/resources/db-master.xml
@@ -406,4 +406,5 @@
+
\ No newline at end of file
diff --git a/orcid-persistence/src/main/resources/db/updates/add_public_api_daily_rate_limit_indexes.xml b/orcid-persistence/src/main/resources/db/updates/add_public_api_daily_rate_limit_indexes.xml
new file mode 100644
index 0000000000..bc25ce9320
--- /dev/null
+++ b/orcid-persistence/src/main/resources/db/updates/add_public_api_daily_rate_limit_indexes.xml
@@ -0,0 +1,18 @@
+
+
+
+ create index concurrently if not exists idx_ip_address on public_api_daily_rate_limit(ip_address);
+
+
+ create index concurrently if not exists idx_client_id on public_api_daily_rate_limit(client_id);
+
+
+ create index concurrently if not exists idx_request_date on public_api_daily_rate_limit(request_date);
+
+
+ create index concurrently if not exists idx_client_ip_date on public_api_daily_rate_limit(client_id, ip_address, request_date);
+
+
+