samedi 31 janvier 2015

Why the simple insert into query allocated a lot of tempdb?


I'm using sp_whoisactive to monitor the tempdb and found the following query allocated 30,000,000 tempdb_allocations (BTW, what's the unit of the allocations?)



select a.*, b.A, b.C, b.D
into c
from db1.dbo.a -- a, which has 2M rows, is a heap and don't have a index on column bid
left join db2.dbo.b on a.bid = b.id -- b has only several hundred rows. clustered PK (id)


Why it allocated so many tempdb space? What's the unit of tempdb_allocations?





Aucun commentaire:

Enregistrer un commentaire