Updating large tables

I start up an Extended Events trace to capture IO from sp_statements completed, then run the command the maintenance plan was going to use to update every statistic on this table with fullscan: Here’s the trace output –click to view it in a larger image: Looking at the Extended Events trace output, I can see the commands that were run as well as their logical reads.

updating large tables-54updating large tables-82

Unfortunately, if you use maintenance plans there’s no super simple solution– it forces you to specify either fullscan or a specific sample.

There’s no way to just use the basic “You compute the minimum sample” with that task.

Person (Title) where Title = 'Ms.' GO Sure enough, this shows us that we have seven stats total– three are related to indexes.

Alright, time to run that sample command excerpted from our maintenance plan.

First, let’s make sure we have some column level statistics on our database. To create some column level stats, I run these queries: --create two column stats using 'auto create statistics' select * from Person.

Person where Middle Name like 'M%'; select * from Person.

Hi, I am using this sql for updating a large table. The first select will return 'abc' and the second select will return '123'. If the second select returns null then the updated record should be a.p_cd = 'abc'. Thanks, Hevan Hi, I have 3 tables which i have to update tab1 using this update.

But i want to use one update query: update tab1 a set a.p_cd = (select b.p_cd from tab2 b where = fetch first row only)