Home > database >  The following fields and index optimization query query statement?
The following fields and index optimization query query statement?

Time:10-07

The following statement is often used when a query, how to add index or add index to which fields will speed up the search, thank you,,,
SELECT
The FROM Cmdt
WHERE IS_PATIENT=0
AND (
STATUS='SCHEDULED'
The OR STATUS='AWAITING'
)
AND END_DATE & gt; NOW ()
SELECT
The FROM Cmdt
WHERE IS_PATIENT=0
The AND STATUS='SCHEDULED'
AND END_DATE & gt; NOW ()
SELECT
The FROM C_mdt
WHERE the STATUS='SCHEDULED'
AND RESERVATION_ID='66'

CodePudding user response:

Only from the point of view of query, two composite index
IS_PATIENT, status, END_DATE
The STATUS, RESERVATION_ID
  • Related