

--Creacion de indices en difrentes tablas para optimizar las consultas de modulo de agenda

CREATE INDEX "ind_appointment_code" ON room_appointment_study_receipt ("appointment_code");
CREATE INDEX "ind_appointment_code2" ON schedule ("appointment_code");
CREATE INDEX "ind_id_patient" ON appointment ("id_patient");
CREATE INDEX "ind_id_persON" ON patient ("id_person");
CREATE INDEX "ind_id_eps" ON appointment ("id_eps");
CREATE INDEX "ind_id_headquarter" ON room ("id_headquarter");
CREATE INDEX "ind_room_name" ON room ("room_name");
CREATE INDEX "ind_date_start" ON schedule ("date_start");
CREATE INDEX "ind_type_schedule" ON schedule ("type_schedule");
CREATE INDEX "ind_document" ON person_data ("document");
CREATE INDEX "ind_firstname" ON person_data ("first_name");
CREATE INDEX "ind_lastname" ON person_data ("first_last_name"); 


--Creacion de indices en  tablas para optimizar las consultas del modulo de lectura

CREATE INDEX "ind_modality" ON study ("id_modality"); 
CREATE INDEX "ind_id_room_app" ON study ("id_room_appointment_study_receipt"); 
CREATE INDEX "ind_room_code" ON room_appointment_study_receipt ("room_code"); 
CREATE INDEX "ind_date_asistencial" ON appointment ("datetime_asistencial"); 