Get data and stats about files in document libraries in SharePoint site from SQL Server
Information about files in document libraries is strored in the table "AllDocs" of Site's content database. Of course, Microsoft doesn't allow to make queries to SharePoint databases directly. But I can't but agree with inserts and updates are not allowed, but select query in the worst case will make just some locks in database. So I guess that in some cases it's much better to execute select query than powershell script.
--Request to find where JS file used in SharePoint use WSS_Content_Portal go SELECT t2.Title, t1.Id ,t1.SiteId ,t1.DirName ,t1.LeafName ,t1.WebId ,t1.ListId ,t1.DoclibRowId ,t1.Type ,t1.Size FROM dbo.AllDocs t1 INNER JOIN dbo.AllWebs t2 on t1.WebId = t2.Id WHERE t1.LeafName like '%.js' AND t1.DeleteTransactionId = 0x
In my database this query was executed about 5 seconds. Of course, there could be some locks in database, but it could take at least 5 hours for similar result via PowerShell.