We have the same database setup on two machines. Same tables. Same indexes. I am running a query that is self joining:
SELECT Column1 ,Column2 ,Column3 ,Column4 ,RowID = RowNumber OVER ( Partition By Column1, ORDER BY Column2) INTO #tmp FROM AuditTable SELECT * FROM #tmp t1 JOIN #tmp t2 ON t2.Column1 = t1.Column1 AND t2.RowiD = t1.RowID +1 We run this query with 20,000 rows on one database/server and it takes 2 minutes to complete with logical reads around 3.2 million.
The same query runs on a different database/server with 150,000 records and returns in a second with logical reads of 2240. What about the servers would make the same query on the same table setup (including indexes / fragmentation/ statistics) run so differently on two different servers