all groups > sql server data warehouse > august 2004 >
You're in the

sql server data warehouse

group:

Statistics, reindex, defragindex... which first?


Statistics, reindex, defragindex... which first? Jéjé
8/16/2004 3:15:54 PM
sql server data warehouse:
Hi,

in a datawarehouse with SQL Server 2000,
what are your recommendations for when to reindex; update stats or just
defrag the indexes?

Actually, I update the statistics of the loaded table in my DTS package.
So, I've 1 DTS by table, and , at the end of the package, I update with a
full scan my statistics.
Because SQL server completly lost its stats after to many updates, and the
query performance slow down.

But when defragmagting indexes? or reindex it?

does a reindex can update the statistics at the same time?

Some of my tables will be updated daily, and other tables weekly. I've
incremental processes and full table processes (I truncate my table and
refill it or I delete the current year information and refill it)
So I presume I have to do different job regarding how the table is filled.

thanks for your guides !

Jerome.

Re: Statistics, reindex, defragindex... which first? Immy
8/18/2004 3:55:04 PM
Unlike DBCC DBREINDEX or any general index build, DBCC INDEXDEFRAG is an
online operation, so it does not hold long-term locks that can block running
queries or updates. Depending on the amount of fragmentation, DBCC
INDEXDEFRAG can be considerably faster than running DBCC DBREINDEX because a
relatively unfragmented index can be defragmented much faster than a new
index can be built. Another advantage is that with DBCC INDEXDEFRAG, the
index is always available, unlike DBREINDEX. A large amount of fragmentation
can cause DBCC INDEXDEFRAG to run considerably longer than DBCC DBREINDEX,
which may or may not outweigh the benefit of the command's online
capabilities. DBCC INDEXDEFRAG will not help if two indexes are interleaved
on the disk because INDEXDEFRAG shuffles the pages in place. To improve the
clustering of pages, rebuild the index.

[quoted text, click to view]

Re: Statistics, reindex, defragindex... which first? Wayne Snyder
8/19/2004 7:02:53 AM
And to answer the second question, a full rebuild of the indexes also
updates statistics, but indexdefrag does not.

--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)

I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org

[quoted text, click to view]

Re: Statistics, reindex, defragindex... which first? Jéjé
8/19/2004 9:08:20 AM
does the full rebuild of an index updates ONLY the statistics of the index
?
or does this action will update ALL statistics?

Because some columns has no indexes, but there is statistics.

"Wayne Snyder" <wayne.nospam.snyder@mariner-usa.com> a écrit dans le message
de news:eGJMtydhEHA.2784@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Re: Statistics, reindex, defragindex... which first? Jacco Schalkwijk
8/20/2004 11:49:19 AM
Reindex only updates the statistics on the indexes that are reindexed.
But if you have statistics on a column without an index, it is an indication
that an index on that column could improve performance, and you should
consider creating an index on it.

--
Jacco Schalkwijk
SQL Server MVP


[quoted text, click to view]

AddThis Social Bookmark Button