LPS-45001 Document library is very slow

Hello Sergio,

According to customer complaints, if a very large number (magnitude of 10k) of documents is present, switching between libraries in Documents and Media is very slow.
This happens only when a non-admin user is navigating the DM, when in-line permission check is applied.

The slowness is caused by an SQL query which is counting the number of documents, and with each counted document, the permission against the document is checked.

The modification I'm sending consists of moving the resource permission scope check to another clause. This improves the execution time of the SQL query.

Thank you,
István