Skip to content

Commit

Permalink
Added indexes for public_api_daily_limit table (#7140)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Camelia-Orcid authored Nov 18, 2024
1 parent 090b7b0 commit d8ca3a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions orcid-persistence/src/main/resources/db-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,5 @@
<include file="/db/updates/add_unique_constraint_external_id_disambiguated_org.xml" />
<include file="/db/updates/add_date_verified_to_email.xml" />
<include file="/db/updates/create_public_api_daily_rate_limit.xml" />
<include file="/db/updates/add_public_api_daily_rate_limit_indexes.xml" />
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
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">

<changeSet id="ADD-PAPI-LIMIT-INDEXES-IP-ADDRESS" author="Camelia Dumitru" runInTransaction="false" dbms="postgresql">
<sql>create index concurrently if not exists idx_ip_address on public_api_daily_rate_limit(ip_address);</sql>
</changeSet>
<changeSet id="ADD-PAPI-LIMIT-INDEXES-CLIENT-ID" author="Camelia Dumitru" runInTransaction="false" dbms="postgresql">
<sql>create index concurrently if not exists idx_client_id on public_api_daily_rate_limit(client_id);</sql>
</changeSet>
<changeSet id="ADD-PAPI-LIMIT-INDEXES-REQUEST-DATE" author="Camelia Dumitru" runInTransaction="false" dbms="postgresql">
<sql>create index concurrently if not exists idx_request_date on public_api_daily_rate_limit(request_date);</sql>
</changeSet>
<changeSet id="ADD-PAPI-LIMIT-INDEXES-COMPOSITE" author="Camelia Dumitru" runInTransaction="false" dbms="postgresql">
<sql>create index concurrently if not exists idx_client_ip_date on public_api_daily_rate_limit(client_id, ip_address, request_date);</sql>
</changeSet>

</databaseChangeLog>

0 comments on commit d8ca3a5

Please sign in to comment.