From 87068eeb72ad5ad8290185febd9a23500dc2ddb7 Mon Sep 17 00:00:00 2001 From: Camelia Dumitru Date: Mon, 18 Nov 2024 13:32:48 +0000 Subject: [PATCH 1/6] Added indexes for public_api_daily_limit table --- .../src/main/resources/db-master.xml | 1 + ...dd_public_api_daily_rate_limit_indexes.xml | 32 +++++++++++++++++++ 2 files changed, 33 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..128b37fc6f --- /dev/null +++ b/orcid-persistence/src/main/resources/db/updates/add_public_api_daily_rate_limit_indexes.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 29f8777937de8daa725a7b8530449feb8ff9dbdc Mon Sep 17 00:00:00 2001 From: Camelia Dumitru Date: Mon, 18 Nov 2024 13:48:18 +0000 Subject: [PATCH 2/6] Added the composite index for client_id ip_address and request_date --- .../updates/add_public_api_daily_rate_limit_indexes.xml | 9 +++++++++ 1 file changed, 9 insertions(+) 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 index 128b37fc6f..cdacf52dd1 100644 --- 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 @@ -14,6 +14,9 @@ + + + @@ -27,6 +30,12 @@ + + + + + + \ No newline at end of file From 11934c8229696d64790aaa2851e655ca9d1b70f0 Mon Sep 17 00:00:00 2001 From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:50:44 +0000 Subject: [PATCH 3/6] fixed formatting --- .../db/updates/add_public_api_daily_rate_limit_indexes.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 index cdacf52dd1..7778ab03fb 100644 --- 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 @@ -15,8 +15,8 @@ - - + + @@ -38,4 +38,4 @@ - \ No newline at end of file + From 64c2febe35c7782ad4ad519880843170ed121ffc Mon Sep 17 00:00:00 2001 From: Camelia Dumitru Date: Mon, 18 Nov 2024 14:34:28 +0000 Subject: [PATCH 4/6] added the indexes concurrently via liquibase --- ...dd_public_api_daily_rate_limit_indexes.xml | 40 +++---------------- 1 file changed, 5 insertions(+), 35 deletions(-) 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 index cdacf52dd1..35d2a10d1c 100644 --- 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 @@ -2,40 +2,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + create index concurrently if not exists idx_ip_address on public_api_daily_rate_limit(ip_address); + 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_id on public_api_daily_rate_limit(client_id); + create index concurrently if not exists idx_client_ip_date on public_api_daily_rate_limit(client_id, ip_address, request_date); - \ No newline at end of file From 091360e64940fc11b08a4db7295035155afdf390 Mon Sep 17 00:00:00 2001 From: Camelia Dumitru Date: Mon, 18 Nov 2024 14:55:25 +0000 Subject: [PATCH 5/6] Created separate changesets per index --- .../add_public_api_daily_rate_limit_indexes.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 index e37f7d248f..50733ef553 100644 --- 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 @@ -2,10 +2,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> - + create index concurrently if not exists idx_ip_address on public_api_daily_rate_limit(ip_address); - 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_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); From 96ff9de245e9b6fe91c4296cf87fef0cbe27254d Mon Sep 17 00:00:00 2001 From: Camelia Dumitru Date: Mon, 18 Nov 2024 15:15:47 +0000 Subject: [PATCH 6/6] Added the dbms postgres --- .../updates/add_public_api_daily_rate_limit_indexes.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 index 50733ef553..bc25ce9320 100644 --- 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 @@ -2,16 +2,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> - + 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);