79687876

Date: 2025-07-02 17:55:51
Score: 2.5
Natty:
Report link

I think I found some explanations and will answer my own question :

The "declare @p5 unknown" in rpc:completed event was merely a side effect of a timeout. Whenever I set an very high time out, the query will complete (sometimes in 20 minutes) and the rpc:completed event will display "declare @p5 dbo.TypeTableGuid" indeed.

I've been fooled by several different intefering problem in fact : The query was made of a lot of

before a (this is an oversimplified example but the actual query does start with "SELECT TOP(1)")

The number of insert varied from 10000 to 65000 as I realised later by debugging the application code. But I suspect the profiler can only save so many characters per query, which would explain why it never recorded more than

in the trace.

The copy/Paste from the profiler to SSMS was then a useless test : the result was always the one I expected (SELECT TOP(1) ...), but based on a subset of data (6521 guid) instead of 65000, so the performance from SSMS were always good.

I can now work on something a bit more interesting, like why this query goes off the rails from time to time or if there is a better way to formulate it. I'm not sure that that udtt variable holding 65000 guid values is a good option...

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • User mentioned (1): @Listeguid
  • User mentioned (0): @Listeguid
  • Self-answer (0.5):
  • Filler text (0.5): XXXXXXXX
  • Filler text (0): XXXXXXXXXXXX
  • Low reputation (1):
Posted by: hill_piper