I would personally always manage to have the sampling you to the brand new up-to-date statistics command made use of otherwise might use when not specifying people Try
Gaby – okay, go ahead and get the ebook Troubleshooting SQL Servers of the Kehayias & Kreuger, or check out all of our Developer’s Help guide to SQL Host Results movies classification from the
Look for [so].[name] Given that [TableName], –[sch].[name] + ‘.’ + [so].[name] Just like the [TableName], [ss].[name] Once the [Statistic], [sp].[last_updated] As the [StatsLastUpdated], [sp].[rows] Because the [RowsInTable], [sp].[rows_sampled] Because [RowsSampled], [sp].[modification_counter] Since [RowModifications], CAST(100 * [sp].[modification_counter] / [sp].[rows] Once the Quantitative(18,2)) Since the [PercentChange] , ROUND(CAST(100.0 * sp.modification_prevent / sp.rows Because the Decimal(18,2)),2) Because the percentTwo On the #StatsToCheck2 Off [sys].[stats] [ss] Signup [sys].[objects] [so] On [ss].[object_id] = [so].[object_id] Signup [sys].[schemas] [sch] Toward [so].[schema_id] = [sch].[schema_id] Exterior Use [sys].[dm_db_stats_properties] ([so].[object_id], [ss].[stats_id]) sp Where [so].[type] = ‘U’ And you will [so].[name] Perhaps not for the (‘TableNotNeedingMaintenance’) And ss.Term Maybe not Within the (Come across statname Regarding admin.dbo.statstoskip) –And you will SP.last_upgraded.5 –And sp.rows>5000000 Order By the Round(CAST(a hundred.0 * sp.modification_prevent / sp.rows Due to the fact Decimal(18,2)),2) DESC,last_up-to-date
– pick * of #statstocheck2 Explore master wade declare int place = 600 — ten hours = 600 minutes limitation having entire process State DATETIME; Set = GETDATE(); e’ age Declare VARCHAR(200) elizabeth,Statistic away from #StatsToCheck2 Unlock c Get 2nd Out of c On the , Whenever you are ( = 0 and DATEDIFF(Moment, , GETDATE()) 0 ROLLBACK – Boost a blunder towards the information on brand new difference State NVARCHAR(4000) , INT
people dining tables in which i need to up-date the data has actually study chantes (Modify, insert , delete) i do not have to eliminate the car create stats: because most other Arrangements is inspired. my last resort are would something so you’re able to inform the newest stats everty a day. Could there be almost every other option?
Come across [so].[name] As [TableName], –[sch].[name] + ‘.’ + [so].[name] Since the [TableName], [ss].[name] Given that [Statistic], [sp].[last_updated] Due to the fact [StatsLastUpdated], [sp].[rows] Because [RowsInTable], [sp].[rows_sampled] While the [RowsSampled], [sp].[modification_counter] Since the [RowModifications], CAST(a hundred * [sp].[modification_counter] / [sp].[rows] Just like the Decimal(18,2)) Due to the fact [PercentChange] , ROUND(CAST(one hundred.0 * sp.modification_counter / sp.rows Because Decimal(18,2)),2) While the percentTwo On #StatsToCheck Off [sys].[stats] [ss] Sign up [sys].[objects] [so] Into the [ss].[object_id] = [so].[object_id] Join [sys].[schemas] [sch] On [so].[schema_id] = [sch].[schema_id] External Pertain [sys].[dm_db_stats_properties] ([so].[object_id], [ss].[stats_id]) sp Where [so].[type] = ‘U’ And you can [so].[name] Not from inside the (‘USER_ACTIVITY_LOG’,’OTTS_HISTORY_NEW’,’XML_SERIALIZED_INSTANCE’,’FILE_RECORD’) And you can ss.Title Not Inside the (Pick statname Regarding administrator.dbo.statstoskip) –And you may Shed(100 * [sp].[modification_counter] / [sp].[rows] Just like the Decimal(18,2)) >= step 1.00 And you will Bullet(CAST(a hundred.0 * sp.modification_avoid / sp.rows While the Decimal(18,2)),2)>.5 And sp.rows>50000 Acquisition By Round(CAST(one hundred.0 * sp.modification_counter / sp.rows Just like the Decimal(18,2)),2) DESC,last_upgraded Use master wade claim int set = 600 — ten circumstances = 600 Claim DATETIME; Set = GETDATE(); Elizabeth Place = ‘MyDatabase’ e State VARCHAR(200) e,Figure away from #StatsToCheck order from the [PercentChange] desc, [StatsLastUpdated] Open c Get 2nd Off c On the , When you’re ( = 0 and you can DATEDIFF(Second, , GETDATE()) 0 ROLLBACK – Increase an error for the specifics of the fresh exception to this rule State NVARCHAR(4000) , INT
I want to change my analytics pretty much every for the majority of dining tables, given that execution ask requires to 50 moments instead ten Sec and there try brief tables, how to end this situation?
Kept it again. Better about cursor loop they performs this. We shall see if the remark demons strip it again:
Carry out learn.dbo.IndexOptimize = , = NULL, = NULL, = NULL, = ‘ALL’, = , = ‘Y’, = one hundred, = 7200, = 8, = ‘Y’, = ‘Y’, =step 1
We have tried Ola’s programs, but could never ever get them to work for myself. http://www.besthookupwebsites.org/nl/fdating-overzicht/ You people are much s. Are an associate go out dBA will not assist me receive any better.
Higher article, I’m trying comprehend the TABLESAMPLE point. Have you got far more insight on this subject? Why, I’m asking would be the fact We pointed out that new Hallengren software, is determined to perform once the “improve statistics TableName indexName… and you can I am contrasting they with my very own program… Within my software according to the quantity of rows the new dining table keeps, We ple, If i got a dining table you to definitely 120M rows, I’d ple 3M rows. My means requires more hours than simply allowing SQL find the testing once the Hallengren does. I attempted to run brand new query you have about TABLESAMPLE section however, couldn’t obtain it to operate… Any idea?