Wednesday, 15 July 2015

sql server - Query hint for insert from stored procedure -


I'm running SQL Server 2014.

In the following code, I have a floating table (defined in the first code) that is being filled with a stored procedure. Most of the parameters for the stored procedure are of standard data types, but @GroupLayoutSpecifications is a table variable that stores a small heap table stored procedure.

  

@GroupLayoutSpecifications;

I have a problem that the query engine is not able to effectively predict the number of rows that are likely to return the stored procedure. It is typical to estimate the return of something like 1 row, with actual returns close to 200k rows. I believe this is what is a tempdb spillover later on in the scheme.

Is it likely that this table type parameter is the reason that the query engine is causing some grief? If so, how can I get around that?

Similarly, the signal to SQL Server that will result in the following query probability is a way to count a greater than expected line?

I have noticed this through a lot of things like MSDN, this site, SQL Authorization, and others, and hope someone here can help me tune this.

You need to supply more information to a reasonable answer, just tell me what you want.

Cheers,

Which


No comments:

Post a Comment