|Subject||Re: Plan question, what is a stream and what isn't?|
> ---In email@example.com, <tdw@...> wrote :As any DDL statement it actually runs at transaction commit.>> If SET STATISTICS is done on one connection, when does it take effect?
> What about a transaction that was already running at the time someoneThink in terms of statements, not transactions\connections. When statement
> else did SET STATISTICS, does that use the new statistics for any new
> statements it runs (where all the code running is in stored procedures)?
> What about a connection that was already in existence at the time
> someone else did SET STATISTICS, does that use the new statistics for
> any new transactions it runs (where all the code running is in stored
is prepared optimizer used most recent statistics to create execution plan.
Note, stored procedures and triggers are prepared\optimized once when
loaded into metadata cache.