Im trying to remove the sort from the execution plan. Unfortunately i cannot change the schema but i can change the indexing. I can provide existing indexes if required, otherwise im happy to put a brand new index on if it will solve this issue (reporting database)
EDIT *** New plan attached with cut down versions of the tables and create scripts including data. Ive added the index definitions that the plan is using. If there is anything else that would help please let me know and i will do my best to provide it (gov department and they get concerned with posting too much information) link text
By Matak 14 asked Apr 08, 2016 at 12:14 AM
It's always harder to work from an anonymized plan, but:
Index4 needs Column4 in the key after Column3. At the moment it seems Column4 is an included column, or perhaps further down the key list.
If that doesn't remove the sort, provide a non-anonymized plan. Table and index DDL would save some time too.
By SQLkiwi ♦ 6.6k answered Apr 08, 2016 at 01:06 AM