-
Notifications
You must be signed in to change notification settings - Fork 87
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
base: master
Are you sure you want to change the base?
Conversation
… to improve query performance
I have updated the PR. Please re-review @gsluthra |
@@ -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"> |
There was a problem hiding this comment.
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!
This PR adds indexes on start_date_time and status columns for improved query perfornance