Could not allocate a new page for database 'TEMPDB' because of insufficient disk space in filegroup 'DEFAULT'. Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
Am facing this error when executing a stored procedure which has select statements which has nearly 250 million records.
Even though I have around 650gb space in tempdb am facing this error. Would like to know what I can do further on this
Query:
SELECT u.Id, u.place, u.name, u.lname, LOWER(ue.email) AS Email, MIN(dp.BirthTime) AS Time
FROM tableA u
JOIN tableB ue ON ue.id = u.id AND ue.Did = 0
JOIN tableC dp ON dp.Id = u.Id
JOIN tableB dpe ON dpe.Id = dp.Id
LEFT JOIN tableB idpe ON idpe.Email = dpe.Email
LEFT JOIN tableE idp ON idp.Id = idpe.Id
LEFT JOIN tableD pidp ON pidp.Id = idp.Id
JOIN tableD cp ON dp.Id = cp.Id
where ISNULL(cp.FName,'') = '' AND ISNULL(cp.LName,'') = '' AND ISNULL(cp.IsActive,0) = 0 AND ISNULL(dp.Isinactive,0) = 0
AND ISNULL(pidp.FName,'') = '' AND ISNULL(pidp.LName,'') = ''
AND ISNULL(pidp.Isactive,0) = 0 AND ISNULL(idp.IsInactive,0)
AND ISNULL(u.EHome, '') != ''
GROUP BY u.Id, u.Isactive, u.name, u.EServer, ue.Email