• Not the solution, but the reason.

    When rebuilding an index, the old index is only dropped once the new one is complete. It's for ease of rollback (can just drop the part-built index structure) and performance (SQL reads the old index to create the new one, alleviating the need to do a sort or read more data than necessary or re-apply any filter in the case of a filtered index), also for online rebuilds to allow queries to read and use the index during the rebuild.

    This isn't the sort space, which is what goes into TempDB when sort in TempDB is on.

    You could try rebuild twice then shrink with truncate_only. Otherwise REORGANIZE which doesn't recreate the index and hence has no such space requirements

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass