We recently migrated from LogShipping standby/read-only
setup to Multi Subnet AG setup with readable secondaries.
Generally on old setup we have select queries running for longer duration as the database in question is over 20 TB and has mix of read write workload on primary.
After moving to new setup of AG we have started seeing blocking which i am not able to understand. Why select queries on secondary are blocking other select queries in my readable secondary replica instance, even when the database being queried has RCSI enabled
?
Below is what i have captured
Lead blocker is some long running
SELECT
query does not show any specific waittype as particular, lets say SPID129
SPID 129
blocks a session ID45
( i am sure this is not a user id) for almost 6 hours which is dependent on spid129 and wait type isLCK_M_SCH_M
Here comes the problem when this
SPID 45
just blocks all other select queries now in that 6 hour duration.
I am not able to understand what is happening. Can someone help me troubleshoot or look in correct direction?
45
must be a redo task which was doing a schema changing operation (index rebuild, for instance). At the same time the session129
was running a query which used that index.