Query Rewrite
Is there a better way to rewrite the SQL Query ? Please, suggest.
In fact the warning on the first node shows that the missing index would be helpful.
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>] ON [dbo].[ITEM_LINK] ( [START_DATETIME], [END_DATETIME], [FROM_ITEM_TYPE] ) INCLUDE ( [FROM_ITEM_ID], [TO_ITEM_ID] );
I am looking more towards, how to avoid the "Nested Loop Inner Joins". i.e. Rewriting the Code using CTE, etc. etc.
Can you give me some suggestions ?
FROM ITEM_PROPERTY c,
ITEM_PROPERTY r,
ITEM_PROPERTY d,
ITEM_PROPERTY s,
ITEM_PROPERTY f,
ITEM_PROPERTY rt,
ITEM_PROPERTY st,
ITEM_PROPERTY i,
ITEM_LINK rc,
ITEM_LINK dr,
ITEM_LINK sd,
ITEM_LINK fs,
ITEM_LINK rs,
ITEM_LINK sr,
ITEM_LINK ist
Why not reference each table you need only once and then modify the WHERE clause conditions as appropriate?
Can you just give me a sample query to start with ?