Help with removing the sort form the plan
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)
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)
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.
Index4 -> (Column3, Column4) include (Column5);
If that doesn't remove the sort, provide a non-anonymized plan. Table and index DDL would save some time too.