I have a couple of tables with specific master data relationships. In the parent block contains about 20 thousand lines, and in the daughter case - 120 to +. This is the main relationship in our application, and its performance is critical.
Its execution is bad: (
The following query is fast and uses my indexes:
SELECT * FROM Parent WHERE TransmissionDate BETWEEN '1-dec-2011' and '2-dec-2011'
And the execution plan displays all the expected requests.
This query is slow (after about a minute to get 1k lines!)
SELECT * FROM Parent LEFT OUTER JOIN child ON Child.ParentID = Parent.ID WHERE TransmissionDate BETWEEN '1-dec-2011' AND '2-dec-2011'
I suspect that I am somewhere a stranger regarding the definition of good indexes. I defined the indices on the parent PC and the combined index on the parent PC and the date field, but this does not help this query.
Thanks in advance:)
EDIT (can't answer my own question since I'm a beginner!)
I deleted the indexes and recreated them, and now everything is happy? Is it possible that they were corrupt? I already rebuilt them ...
Nathan
source share