SQL Server - What taks/queries should I need to execute when there is a lack of space in TempDB? I am having some troubles loading data to my fact table. Every time that I want to insert, I'm getting the following issue:


  Could not allocate space for object 'dbo.SORT temporary run storage:  140739614015488' in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.


My question is: Which practices should I apply in order to understand why this error or to know if tempDB is close to full or not? There exists any queries that normally tell me some information about this?
Check your index rebuild plan, db.SORT usually indicates a SORT_IN_TEMPDB option being used and not enough space to accommodate it.