dimanche 28 juin 2015

Statistics wont show when table is created

I am reading white paper on statistics,but i am not able to get answers to few questions

In Summary
dbcc show_Statistics ('stats_update','PK__stats_up__3213E83FCCAB6EF5') is not getting populated.Below is the total code to reproduce

create table stats_update
(
id int identity(1,1)  primary key,
name char(20) default 'a'
)

--check for stats
sp_helpstats 'stats_update'

--insert two values
insert into stats_update
default values
go 2

--check for stats
sp_helpstats 'stats_update','all'

select * from stats_update



--lets create an index now on name 
create index nci_test on dbo.stats_update(name)

--check for stats
sp_helpstats 'stats_update','all'

--lets see when we stats last updated

dbcc show_Statistics ('stats_update','PK__stats_up__3213E83FCCAB6EF5')


--now lets insert some  rows
insert into stats_update
default values
go 200

--lets check stats again

--check for stats
sp_helpstats 'stats_update','all'

dbcc show_Statistics ('stats_update','PK__stats_up__3213E83FCCAB6EF5')

select * from sys.stats where object_id=object_id('stats_update')


insert into stats_update
default values
go 2000

select * from stats_update

select * from stats_update where id=10

Aucun commentaire:

Enregistrer un commentaire