Hi,
In SQL Server 2008 R2 and up, is it a performance issue if in a stored procedure a temp table is created, then loaded, then an index created on it?
Or should it create that a temp table is created, an index created on that temp table and then loaded?
Also, if it not true that IF after subsequently done in this matter, if the temp table is used in any way in that stored procedure the optimizer would not even know about the existence of the index on that temp table.
It should be that a parent stored procedure, creates the temp table, creates the index, loads it and then calls a child stored procedure and in that child stored procedure it uses that temp table?
Any confirmation on this would be greatly appreciated.
In SQL Server 2008 R2 and up, is it a performance issue if in a stored procedure a temp table is created, then loaded, then an index created on it?
Or should it create that a temp table is created, an index created on that temp table and then loaded?
Also, if it not true that IF after subsequently done in this matter, if the temp table is used in any way in that stored procedure the optimizer would not even know about the existence of the index on that temp table.
It should be that a parent stored procedure, creates the temp table, creates the index, loads it and then calls a child stored procedure and in that child stored procedure it uses that temp table?
Any confirmation on this would be greatly appreciated.