DECLARE @Success Bit DECLARE @LXListOverallFilterModDate DateTime DECLARE @LXListOverallFilterModDate2 DateTime SET @Success=1 SET @LXListOverallFilterModDate='2013-08-01 00:00:00' SET @LXListOverallFilterModDate2='2013-08-30 23:59:59' SELECT Table.Numero AS LXPrimaryKey INTO #Temp FROM Table (NOLOCK) INNER JOIN Table2 ON Table.NoTable2=Table2.Numero INNER JOIN TableStatus ON Table.NoTableStatus=TableStatus.Numero WHERE (Table.Success=@Success) AND Table.NoField=1 AND Table.ModDate>=@LXListOverallFilterModDate AND Table.ModDate<=@LXListOverallFilterModDate2 CREATE CLUSTERED INDEX LXPrimaryKey ON #Temp(LXPrimaryKey) SELECT Table.Numero AS LXPrimaryKey,Table.AddDate,Table.ModDate,Table2.Something,'' AS Output2,'' AS Input2, TableStatus.Title_E AS Status,'' AS Message2,Table.Process,Table.Numero,Table.Output,Table.Input,Table.Message, Table.NoTableStatus FROM Table (NOLOCK) INNER JOIN Table2 ON Table.NoTable2=Table2.Numero INNER JOIN TableStatus ON Table.NoTableStatus=TableStatus.Numero WHERE Table.Numero IN (SELECT #Temp.LXPrimaryKey FROM #Temp) ORDER BY Table.ModDate DESCThe last SQL is where this is taking long. On the previous approach, when I was not going into a temporary table and getting they keys from a WHERE IN clause, this was fast. It is difficult to understand why that method was faster than this one. However, the previous method was not bullet proof as it was failing when there was too many keys. So, I need to find what is causing this with this one. I believe this is in the good direction to do it. There is just something that need to be improved.