-- 통계정보를수동으로갱신할경우
CREATE STATISTICS NAMES
ON CUSTOMERS (COMPANYNAME, CONTACTNAME)
WITH SAMPLE 5 PERCENT
GO
SP_HELPINDEX CUSTOMERS
--테이블이나인덱스의조각난정도를볼경우
DBCC SHOW_STATISTICS (CUSTOMERS, PK_CUSTOMERS)
SP_SPACEUSED ORDERS
-- EMPLOYEE 테이블의모든인덱스에대한통계업데이트
USE TESTDB;
UPDATE STATISTICS EMPLOYEE;
GO
-- EMPLOYEE 테이블의PK_EMPLOYEE_EMPLOYEEID 인덱스에대한통계업데이트
UPDATE STATISTICS EMPLOYEE PK_EMPLOYEE_EMPLOYEEID;
GO
-- TESTDB 데이터베이스내의모든내부테이블의통계업데이터
USE TESTDB;
EXEC SP_UPDATESTATS
GO