Subject | Re: another make my query faster question |
---|---|
Author | markd_mms |
Post date | 2006-07-13T06:40:27Z |
if i add an OR condition to the where clause then the time ballons out
again with 99206 un-indexed reads on the PRODUCT table. if i make it
an AND condition then the query remains really fast. is there any way
to speed OR up?
i tried different conditions like =, LIKE, CONTAINING but it didn't
seem to make a difference.
query...
SELECT PRODUCT.PRODUCTID, PARTICIPANT_NAME.NAME, TITLE.NAME,
LEVENSHTEINC(UPPER(TITLE.NAME), 'AFTER THE BALL')
FROM TITLE
LEFT JOIN PRODUCT ON PRODUCT.TITLEID = TITLE.TITLEID
INNER JOIN PRODUCT_PARTICIPANT ON PRODUCT.PRODUCTID =
PRODUCT_PARTICIPANT.PRODUCTID
INNER JOIN PARTICIPANT_NAME ON PRODUCT_PARTICIPANT.PARTICIPANTID =
PARTICIPANT_NAME.PARTICIPANTID
WHERE TITLE.METAPHONE = METAPHONE('after the ball')
OR TITLE.NAME CONTAINING 'after the ball'
ORDER BY 4, 3, 2
and plan...
Plan:
PLAN SORT (JOIN (JOIN (JOIN (TITLE INDEX (IDX_TITLE_METAPHONE_ASC),
PRODUCT INDEX (IDX_PRODUCT_TITLEID)), PRODUCT_PARTICIPANT INDEX
(PK_PRODUCT_PARTICIPANT)), PARTICIPANT_NAME INDEX (PK_PARTICIPANT_NAME)))
Adapted plan:
PLAN SORT (JOIN (JOIN (JOIN (TITLE INDEX (IDX_TITLE_METAPHONE_ASC),
PRODUCT INDEX (IDX_PRODUCT_TITLEID)), PRODUCT_PARTICIPANT INDEX
(PK_PRODUCT_PARTICIPANT)), PARTICIPANT_NAME INDEX (PK_PARTICIPANT_NAME)))
TIA
again with 99206 un-indexed reads on the PRODUCT table. if i make it
an AND condition then the query remains really fast. is there any way
to speed OR up?
i tried different conditions like =, LIKE, CONTAINING but it didn't
seem to make a difference.
query...
SELECT PRODUCT.PRODUCTID, PARTICIPANT_NAME.NAME, TITLE.NAME,
LEVENSHTEINC(UPPER(TITLE.NAME), 'AFTER THE BALL')
FROM TITLE
LEFT JOIN PRODUCT ON PRODUCT.TITLEID = TITLE.TITLEID
INNER JOIN PRODUCT_PARTICIPANT ON PRODUCT.PRODUCTID =
PRODUCT_PARTICIPANT.PRODUCTID
INNER JOIN PARTICIPANT_NAME ON PRODUCT_PARTICIPANT.PARTICIPANTID =
PARTICIPANT_NAME.PARTICIPANTID
WHERE TITLE.METAPHONE = METAPHONE('after the ball')
OR TITLE.NAME CONTAINING 'after the ball'
ORDER BY 4, 3, 2
and plan...
Plan:
PLAN SORT (JOIN (JOIN (JOIN (TITLE INDEX (IDX_TITLE_METAPHONE_ASC),
PRODUCT INDEX (IDX_PRODUCT_TITLEID)), PRODUCT_PARTICIPANT INDEX
(PK_PRODUCT_PARTICIPANT)), PARTICIPANT_NAME INDEX (PK_PARTICIPANT_NAME)))
Adapted plan:
PLAN SORT (JOIN (JOIN (JOIN (TITLE INDEX (IDX_TITLE_METAPHONE_ASC),
PRODUCT INDEX (IDX_PRODUCT_TITLEID)), PRODUCT_PARTICIPANT INDEX
(PK_PRODUCT_PARTICIPANT)), PARTICIPANT_NAME INDEX (PK_PARTICIPANT_NAME)))
TIA