FINERACT-2181: Remove suboptimal indexes

This commit is contained in:
Adam Saghy
2025-07-15 10:53:26 +02:00
parent 42ff9743dd
commit 9e15e459f0
3 changed files with 57 additions and 133 deletions
@@ -50,7 +50,7 @@
<include relativeToChangelogFile="true" file="parts/1025_store_pre_closure_strategy_to_loan_level.xml"/>
<include relativeToChangelogFile="true" file="parts/1026_add_interest_recognition_flag.xml"/>
<include relativeToChangelogFile="true" file="parts/1027_add_capitalized_income_transaction_type.xml"/>
<include relativeToChangelogFile="true" file="parts/1028_add_missing_indexes.xml"/>
<include relativeToChangelogFile="true" file="parts/1028_remove_suboptimal_indexes.xml"/>
<include relativeToChangelogFile="true" file="parts/1029_add_installment_amount_in_multiples_of_to_loan.xml"/>
<include relativeToChangelogFile="true" file="parts/1030_add_loan_undo_contract_termination_event.xml"/>
</databaseChangeLog>
@@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<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-4.3.xsd">
<changeSet author="fineract" id="1-postgres" context="postgresql" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_transaction_type_enum_index"/>
</not>
</preConditions>
<sql>
CREATE INDEX CONCURRENTLY m_loan_transaction_transaction_type_enum_index
ON m_loan_transaction (transaction_type_enum);
</sql>
</changeSet>
<changeSet author="fineract" id="2-postgres" context="postgresql" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_transaction_date_index"/>
</not>
</preConditions>
<sql>
CREATE INDEX CONCURRENTLY m_loan_transaction_transaction_date_index
ON m_loan_transaction (transaction_date);
</sql>
</changeSet>
<changeSet author="fineract" id="3-postgres" context="postgresql" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_created_on_utc_index"/>
</not>
</preConditions>
<sql>
CREATE INDEX CONCURRENTLY m_loan_transaction_created_on_utc_index
ON m_loan_transaction (created_on_utc);
</sql>
</changeSet>
<changeSet author="fineract" id="4-postgres" context="postgresql" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_is_reversed_index"/>
</not>
</preConditions>
<sql>
CREATE INDEX CONCURRENTLY m_loan_transaction_is_reversed_index
ON m_loan_transaction (is_reversed);
</sql>
</changeSet>
<changeSet author="fineract" id="5-postgres" context="postgresql" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_submitted_on_date_index"/>
</not>
</preConditions>
<sql>
CREATE INDEX CONCURRENTLY m_loan_transaction_submitted_on_date_index
ON m_loan_transaction (submitted_on_date);
</sql>
</changeSet>
<changeSet author="fineract" id="1-mysql" context="mysql">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_transaction_type_enum_index"/>
</not>
</preConditions>
<createIndex indexName="m_loan_transaction_transaction_type_enum_index" tableName="m_loan_transaction">
<column name="transaction_type_enum"/>
</createIndex>
</changeSet>
<changeSet author="fineract" id="2-mysql" context="postgresql" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_transaction_date_index"/>
</not>
</preConditions>
<createIndex indexName="m_loan_transaction_transaction_date_index" tableName="m_loan_transaction">
<column name="transaction_date"/>
</createIndex>
</changeSet>
<changeSet author="fineract" id="3-mysql" context="postgresql" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_created_on_utc_index"/>
</not>
</preConditions>
<createIndex indexName="m_loan_transaction_created_on_utc_index" tableName="m_loan_transaction">
<column name="created_on_utc"/>
</createIndex>
</changeSet>
<changeSet author="fineract" id="4-mysql" context="postgresql" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_is_reversed_index"/>
</not>
</preConditions>
<createIndex indexName="m_loan_transaction_is_reversed_index" tableName="m_loan_transaction">
<column name="is_reversed"/>
</createIndex>
</changeSet>
<changeSet author="fineract" id="5-mysql" context="postgresql" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="m_loan_transaction_submitted_on_date_index"/>
</not>
</preConditions>
<createIndex indexName="m_loan_transaction_submitted_on_date_index" tableName="m_loan_transaction">
<column name="submitted_on_date"/>
</createIndex>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<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-4.3.xsd">
<changeSet author="fineract" id="drop-index-1" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<indexExists indexName="m_loan_transaction_transaction_type_enum_index"/>
</preConditions>
<dropIndex indexName="m_loan_transaction_transaction_type_enum_index" tableName="m_loan_transaction"/>
</changeSet>
<changeSet author="fineract" id="drop-index-2" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<indexExists indexName="m_loan_transaction_transaction_date_index"/>
</preConditions>
<dropIndex indexName="m_loan_transaction_transaction_date_index" tableName="m_loan_transaction"/>
</changeSet>
<changeSet author="fineract" id="drop-index-3" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<indexExists indexName="m_loan_transaction_created_on_utc_index"/>
</preConditions>
<dropIndex indexName="m_loan_transaction_created_on_utc_index" tableName="m_loan_transaction"/>
</changeSet>
<changeSet author="fineract" id="drop-index-4" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<indexExists indexName="m_loan_transaction_is_reversed_index"/>
</preConditions>
<dropIndex indexName="m_loan_transaction_is_reversed_index" tableName="m_loan_transaction"/>
</changeSet>
<changeSet author="fineract" id="drop-index-5" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<indexExists indexName="m_loan_transaction_submitted_on_date_index"/>
</preConditions>
<dropIndex indexName="m_loan_transaction_submitted_on_date_index" tableName="m_loan_transaction"/>
</changeSet>
</databaseChangeLog>