Using ALTER PROC to deploy changes preserves the object_id. Using DROP followed by CREATE changes the object_id. This is important for DBAs managing Forced Plans. When object_id changes, Query Store generates a new sys.query_store_query entry with a new query_id, even if the query text remains the same. The forced plan stops working in this case, and DBAs must reconfigure it.
Testing:
CREATE PROC TestSP AS BEGIN SELECT 1; END; GO SELECT * FROM sys.objects WHERE name ='TestSP'; GO ALTER PROC TestSP AS BEGIN SELECT 2; END; GO SELECT * FROM sys.objects WHERE name ='TestSP'; GO DROP PROC TestSP; GO CREATE PROC TestSP AS BEGIN SELECT 2; END; GO SELECT * FROM sys.objects WHERE name ='TestSP';
No comments:
Post a Comment