• after reviewing the execution plan I think there are few things which we can take care of, for performance -

    1. Index IX_Portfolio, on the table dbo.Portfolio needs to be tuned. The query is costing 61%

    2. The cardinality estimate warning might be the reason which is affecting the above index. So need to check the data type for the date column - NAVdate.

    3. Using TOP 1 and order by, can you give better performance than 'MAX' operation.

    4. Apply index on the #temp table.