I am having an issue where I can run a query in SQL Sever management studio but the same query hangs when I run it from Mybatis. The activity monitor shows many processes started by the query that seem to be clocking each other with many cxpacket and pageiolatch_sh waits.
The audit_player table has 267 million rows, player and playerInfo 350,000 and currency 20.
Any ideas on what could cause this?
select 'INS' as typeOfChange,
p.playerId as "model.id"
from Player p
INNER join
(select DISTINCT(playerId) as playerId
from Audit_Player
where modifiedDate > '2012-11-14 14:35:47' and action in ('INS', 'UPD') and tester = 0) ap
on p.playerId = ap.playerId
left outer join PlayerInfo i on i.playerId = p.playerId
left outer join Currency c on c.curName = i.curName where c.curCode <> 'XXX'
UNION
select 'DEL' as typeOfChange,
playerId as "model.id"
from Audit_Player
where modifiedDate > '2012-11-14 14:35:47' and action = 'DEL'