Query causing disk space issues

  • OK, I'm out of ideas.

    Rather than use an existing document management model, my company has decided to build their own. In this model, they are storing actual documents in the database in BLOB format (nvarchar(max)). To this point, there really isn't a problem.

    We recently started having disk space issues on the server containing this database instance. Doing a SELECT * from {table} is causing something to be written to the C drive. Restarting services does NOT free the disk space but a reboot does. My first thought was tempdb, but tempdb is on the D drive (as are all system databases) and does not change at all in size before, during, or after the query is run. What am I missing?

    The SELECT * is just ad hoc testing to find the problem. The actual code is cleaner but is, over time, causing disk space issues.

  • I hate these types of responses, but how are you certain that it's the query that's causing something to be written to that volume?

  • That's a fair question.

    I don't know that I can prove it 100%. What I can say, though, is that I can monitor disk space for the better part of 15 minutes and not see it change. Then I run a query such as SELECT TOP 500 FROM {table} and watch the available disk space get smaller and smaller. Space continues to decrease until either I stop the query or execution completes. The disk space is stable again (unchanged for several hours).

  • Jeff K (9/26/2012)


    ... Doing a SELECT * from {table} is causing something to be written to the C drive. Restarting services does NOT free the disk space but a reboot does. ...

    I "guess" virtual memory is causing this issue.

  • Hang on, are you running this Select * from <table> from SSMS on the local server?

    The data you see in the results tab has to go somewhere. Remember that SSMS is a client not a server, so it has to receive data and then store it, so you can see it in a grid.

    SSMS backs the query result tab to temporary files in the user's temp folder, which is likely to be stored on the C drive. If it's a massive table, you'll get massive temp files.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply