Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add indexes on patient appointment start_date_time and status columns… #163

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ojwanganto
Copy link
Contributor

This PR adds indexes on start_date_time and status columns for improved query perfornance

@ojwanganto
Copy link
Contributor Author

I have updated the PR. Please re-review @gsluthra

@ojwanganto
Copy link
Contributor Author

ping @gsluthra @angshu

@@ -749,4 +749,10 @@
update patient_appointment set date_appointment_scheduled = date_created where date_appointment_scheduled is null;
</sql>
</changeSet>
<changeSet author="bahmni-appointments" id="add_index_on_patient_appointment_start_date_time_202411281139">
<comment>add index on patient_appointment start_date_time column</comment>
<createIndex indexName="patient_appointment_start_date_time_index" tableName="patient_appointment">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ojwanganto Thank you for the update! The changeset correctly adds an index to the start_date_time column in the patient_appointment table. However, to prevent duplicate index creation errors, it would be best to include a precondition to check if the index already exists before creating it.

Please add the following precondition before the <createIndex> tag:

<preConditions onFail="MARK_RAN">
    <not>
        <indexExists indexName="patient_appointment_start_date_time_index" tableName="patient_appointment"/>
    </not>
</preConditions>

Adding a precondition would prevents redundant index creation, help avoid migration failures if the index already exists and will ensure safe and idempotent schema updates.

Could you please update the changeset accordingly? Let me know if you have any questions. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants