sql server - Copy Stored Proc Execution Plan to Another Database -
setup:
using sql server 2008 r2.
we've got stored procedure has been intermittently running long. i'd test theory parameter sniffing causing query engine choose bad plan.
question:
how can copy query's execution plans 1 database (test) database?
note:
i'm aware may not parameter sniffing issues. however, i'd go through motions of creating test plan , using it, if @ possible. therefore please not ask me post code and/or table schema, since irrelevant @ time.
plans not portable, bind object ids. can use planguides, strictly tied database. have test on restored backup of same database. on restored backup can use planguide. relevance physical characteristics of machines should similar (cpus, ram, disks).
normally though 1 not need resort such shenanigans copy plans. looking @ actual execution plans answers right there.