My problem 'LIKE' child

Last Post 07 Apr 2009 10:53 AM by SQL_Veteran. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
New Member
New Member

17 Jan 2009 05:51 AM
I'm getting an index seek on this, but it's taking up about 70 percent of my query time.

UPDATE #events SET orderNo = ei.orderNo
FROM #events e
JOIN eventItems_rob ei ON ei.eventValue = e.serviceID
WHERE e.orderNo = '[NONE]' AND ei.eventTime BETWEEN @fromDate AND @thruDate AND ei.orderNo <> '[NONE]'
AND (ei.event = 'ServiceAddedToOrder' OR ei.event LIKE 'Search-%')
AND ISNUMERIC(ei.eventValue) = 1

Guessing it's cause of the like?

I have a non clustered on orderno,event,eventime,eventvalue.

Any ideas, I can't use a literal in place of the like.

Should I try making it a clustered?
New Member
New Member

07 Apr 2009 10:53 AM
An index on eventItems_rob starting with eventTime will allow direct access to just the rows in your time range of interest. You can't get that with the index you have now because you aren't giving specific values or ranges for its first two columns (orderno and event). That should speed things up.

Acceptable Use Policy