Dinesh,
The stats collection operation uses an access lock on the table and can be run when that table is being read or updated by a query. You can see this access lock if you do an explain on the collect statistics statement.
However at the completion of a collect stats, all query plans using that table will be flushed from request cache. That may or may not have an impact on subsequent queries that access that table depending on if they were eligible to use cached plans and could have used cached plans.
While you can do it, it's probably not ideal to run an update job against that table you are collecting stats on as the stats will not reflect the actual state of the table when the updates are complete. It is recommended to run stats collection after loading is complete not during loading.
In terms of the query performance, when a select statement is executing, it has already had its plan built. It will have used whatever statistics were available at that time the query began to build its query plan. Even is updated statistics are collected while the query is executing, it will not change that query's plan. So there will be no impact in terms of the plan changing.
A collect statistics statement will use some level of resources. It is like an aggregation. Depending on the priority at which statistics are executed, and the priority at which the query is executing, and the size and complexity of the collect statistics aggregation, the additional resource usage from the stats collection could have a performance impact on the running query.
Thanks, - Carrie
Dinesh,
The stats collection operation uses an access lock on the table and can be run when that table is being read or updated by a query. You can see this access lock if you do an explain on the collect statistics statement.
However at the completion of a collect stats, all query plans using that table will be flushed from request cache. That may or may not have an impact on subsequent queries that access that table depending on if they were eligible to use cached plans and could have used cached plans.
While you can do it, it's probably not ideal to run an update job against that table you are collecting stats on as the stats will not reflect the actual state of the table when the updates are complete. It is recommended to run stats collection after loading is complete not during loading.
In terms of the query performance, when a select statement is executing, it has already had its plan built. It will have used whatever statistics were available at that time the query began to build its query plan. Even is updated statistics are collected while the query is executing, it will not change that query's plan. So there will be no impact in terms of the plan changing.
A collect statistics statement will use some level of resources. It is like an aggregation. Depending on the priority at which statistics are executed, and the priority at which the query is executing, and the size and complexity of the collect statistics aggregation, the additional resource usage from the stats collection could have a performance impact on the running query.
Thanks, - Carrie