TFS runs this query when deploying

Henrik Staun Poulsen 2016-04-08 10:17:42

TFS runs this query when deploying. Normally fast, but on our test server it runs for hours.

We have created a question on StackOverflow:

with the full explaination.

SQLkiwi 2016-04-17 05:13:33
Does the query still run for a long time if you run it as a user with sysadmin permissions?

The objectproperty filter occurs very early on, so I suspect the runtime is due to the expense of checking permissions (has access). Running as sysadmin will skip those checks.

A post-execution (actual) plan would be much more useful than a pre-execution (estimated) plan here.

Henrik Staun Poulsen 2016-04-26 05:58:06
Hi SQLkiwi,

Thank you very much for trying to solve this problem.
Yes, when we deploy, we have sysadmin permissions.
Even so, it took hours.

When our DBA looked at the problem he first tried CheckCatalog and CheckAlloc. No problems found.
When he updated the statistics, everything runs in seconds again.

If it occurs again, I'll include an actual execution plan.