We are running Gradual delete timer job on large site collection and want to trace the progress of this job on content deletion.

So, I wanted to check the rows count on 'AllDocs' table for a particular site collection, so that i can compare the table data count with before and after gradual delete job started.

How to check this in SQL on that site content database?

2 Answers 2


Doing anything in SQL on SharePoint databases, sans the Usage database, is not supported.

That said, the query would be:

SELECT COUNT(Id) FROM AllDocs (NoLock) WHERE SiteId = '<SiteCollectionId>'

Support for changes to the databases that are used by Office server products and by Windows SharePoint Services

  • thank you. can we run the queries which are read only outputs from database without any update queries
    – kumar
    Jan 17, 2018 at 9:19
  • You shouldn't be. Treat SharePoint databases as black boxes. Instead use the proper APIs in SharePoint to accomplish what you require.
    – user6024
    Jan 17, 2018 at 15:45

Here are few links which might be helpful for you

PowerShell Script to List the documents checked out with version details in a Site Collection

Know in which content database my site collection is stored

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.