DavidPageGroup / cdm-data

Tools and information for working with data in CDM format
MIT License
1 stars 1 forks source link

add drug_type_concept_id from drug_exposure to indexes #2

Closed jbadger3 closed 6 years ago

jbadger3 commented 6 years ago

I added drug_type_concept_id to the list of indexes for the drug_exposure table. The field is useful for determining the origin of a drug exposure as 'prescription written', 'medication list entry', etc. I have been running queries using this field as a filter and am running into long execution times. I'm hoping addition of this index will help speed things up a bit.

afbarnard commented 6 years ago

Perhaps you can name the index idx_drug_exp__type_id? I think "type_id" is better than dtc_id because "drug" is redundant in this content and so is "concept". (All of the IDs in all the tables are concept IDs except for the patient and record IDs and those are never foreign keys.) That leaves type_id. Now that could mean either "drug type ID" or "drug exposure type ID", but I think those are effectively the same for our purposes.

jbadger3 commented 6 years ago

Good point. I have updated the current pull request to reflect the recommended change.

afbarnard commented 6 years ago

Accepted and merged.