Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Index Defragmentation and update stats Expand / Collapse
Author
Message
Posted Monday, March 14, 2011 11:00 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, April 17, 2014 4:56 AM
Points: 1,002, Visits: 884
Comments posted to this topic are about the item Index Defragmentation and update stats

/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

Post #1078125
Posted Tuesday, March 15, 2011 5:54 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, April 17, 2014 4:56 AM
Points: 1,002, Visits: 884
An interesting note, I just found this error. I will look at how to address it.

Msg 2725, Level 16, State 2, Line 1

An online operation cannot be performed for index 'PK_notable_query_plan' because the index contains column 'query_plan' of data type text, ntext, image, varchar(max), nvarchar(max), varbinary(max), xml, or large CLR type. For a non-clustered index, the column could be an include column of the index. For a clustered index, the column could be any column of the table. If DROP_EXISTING is used, the column could be part of a new or old index. The operation must be performed offline.


/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

Post #1078253
Posted Wednesday, April 6, 2011 2:43 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Today @ 6:26 AM
Points: 30, Visits: 297
You may want to reconsider your use of sp_updatestats as the only way to update the statistics of the database. This normally will only sample a portion of each table and you may not be getting the best query plan as a result. I have seen where it will do a full scan, but sometimes I have seen it scan below 1% if the table is large enough.
Post #1089592
Posted Thursday, April 14, 2011 11:33 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, April 17, 2014 4:56 AM
Points: 1,002, Visits: 884
There is included an option for a full rescan if update stats is a selected option

/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

Post #1093700
Posted Thursday, May 19, 2011 7:27 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, March 24, 2014 6:01 AM
Points: 191, Visits: 317
I changed a few references to @DBName to quotename(@DBName) as there is an issue with database names with spaces.

Otherwise, thanks very much.
Post #1111678
Posted Thursday, June 9, 2011 2:12 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 15, 2014 2:59 PM
Points: 1,373, Visits: 733
Some changes I would make:

- get rid of the switch from full or bulk to simple mode or make this an option. This could break log shipping, backup chains, etc. if not careful.

- If the index is rebuilt, skip the update stats portion. An index rebuild always updates stats with a 100% sampling rate. (See http://www.sqlskills.com/BLOGS/PAUL/post/Search-Engine-QA-10-Rebuilding-Indexes-and-Updating-Statistics.aspx)

Otherwise, very nice.
Post #1123004
Posted Thursday, June 9, 2011 2:18 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 15, 2014 2:59 PM
Points: 1,373, Visits: 733
shaun.stuart (6/9/2011)
Some changes I would make:

- get rid of the switch from full or bulk to simple mode or make this an option. This could break log shipping, backup chains, etc. if not careful.


Oops. just noticed this was an option already
Post #1123011
Posted Wednesday, August 24, 2011 7:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 29, 2014 3:22 AM
Points: 3, Visits: 46
if i excecute i got below error.

Msg 2552, Level 16, State 1, Line 1
The index "INDEXNAME" (partition 1) on table "TABLENAME" cannot be reorganized because page level locking is disabled.

Does allow_page_locks should be considered?
Post #1164682
Posted Wednesday, August 24, 2011 7:46 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 29, 2014 3:22 AM
Points: 3, Visits: 46
I think it if page level locking is disabled then you have to rebuild and not reorganize.
Post #1164686
Posted Wednesday, August 24, 2011 8:34 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, April 17, 2014 4:56 AM
Points: 1,002, Visits: 884
skraghava (8/24/2011)
I think it if page level locking is disabled then you have to rebuild and not reorganize.


Send me a private message and I will send you the latest version of this script, it has a few kinks worked out after further QA in different environments.


/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

Post #1164727
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse