Sql-server – Stored procedure query plan different in Always on server

sql server

Stored procedure run 10 sec in primary server but keeps running(not executed) in secondary server in always on configured servers. I've verified all configurations, both are identical but execution plans are different. How to make both plans are identical in always on sql server 2012 version.

Best Answer

They are not identical:
on primary you have probably different cached data.

A longer time can be consequence of more time spent on disk.
Also statistics are different: you have in both database the statistics created on primary. But on secondary you also have statistics stored in tempdb.

You can go deeper comparing the execution plans.