I have a production database and staging database, they contain the exact same data, the production database was backed up and restored as the staging database.
A particular operation (API call) always runs in about 200ms when connected to the Staging database but in production it always takes around 1700ms.
I thought the indexes might need reorganizing in production and in staging they could be in better shape because it was restored from a backup but when I ran
sys.dm_db_index_physical_stats(NULL,NULL,NULL,NULL,NULL) ddips
the index fragmentation is pretty much the same between both databases.
I can try restarting the database server late at night and see if that brings up the performance but i'm really puzzled as to why one database would be so much different to the other in query performance when they contain the same data.