1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
--use a histogram for a table
-- CREATE STATISTICS clause
CREATE DATABASE HistogramUseForATable
CREATE TABLE Email1
(ContactId int IDENTITY(1,1) NOT NULL,
FirstName varchar(16),
LastName varchar(16),
EmailAddress varchar(320) --lungimea maxima a unei adrese de e-mail este 320
)
INSERT INTO Email1 (FirstName,LastName,EmailAddress)
VALUES ('Pop', 'Virgil', 'popvirgil@yahoo.com');
INSERT INTO Email1(FirstName,LastName,EmailAddress)
VALUES ('Chapuis', 'Remy', 'chapuisremy@yahoo.fr');
INSERT INTO Email1(FirstName,LastName,EmailAddress)
VALUES ('Joubert', 'Brian', 'brianjoubert@yahoo.fr');
SELECT * FROM Email1
CREATE STATISTICS ContactMail1
ON dbo.Email1 (ContactID, EmailAddress)
WITH SAMPLE 5 PERCENT;
--vizualizare histograma
DBCC SHOW_STATISTICS('Email1', 'ContactMail');
--stergere histograma
DROP STATISTICS Email1.ContactMail
--VIEW STATISTICS ContactMail -- pt.vizualizare histograma
sp_helpstats Email1 |
Partager