User Profile
Collapse
-
How to compose SQL queries with quality?
is there some principles or guide lines? -
Chandler replied to SQL condition optimization:How to optimize statements with greater than condition inin MySQLwithout database object information, the suggestions by PawSQL are:
CREATE INDEX PAW_IDX13608813 32 ON db_sub_warehous e(billcode,subw arehouse_id,TEM P_VAR2);
CREATE INDEX PAW_IDX19216821 21 ON db_sub_warehous e_b(subwarehous e_id,temp_var1, temp_var2,PHONE NUMBER);
you may get more accurate suggestions by supplying more information to the tool. -
I would suggest
Step 1: rewrite the query body to
...Code:SELECT o1.* FROM "sample"."order" o1 JOIN "sample".patient p1 ON o1.patient_id = p1.id WHERE o1.sample_id != _sampleId AND p1.mrn = _mrn AND o1.collection_date is not null AND o1.collection_date >= _createdDate union SELECT o1.* FROM "sample"."order"Leave a comment:
No activity results to display
Show More
Leave a comment: