Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexoptimize procedure fails when updating statistics on partitioned tables #828

Closed
BernaLudo opened this issue Oct 30, 2024 · 2 comments · Fixed by #872
Closed

Indexoptimize procedure fails when updating statistics on partitioned tables #828

BernaLudo opened this issue Oct 30, 2024 · 2 comments · Fixed by #872

Comments

@BernaLudo
Copy link

wrong order options in statement

SQL Server version and edition
Execute SELECT @@VERSION
Microsoft SQL Server 2022(RTM-CU9) (KB5030731) - 16.0.4085.2 (x64)

Version of the script
Check the header of the stored procedure

--// Source: https://ola.hallengren.com //--
--// License: https://ola.hallengren.com/license.html //--
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
--// Version: 2024-10-27 11:48:54 //--

What command are you executing?
EXECUTE dbo.IndexOptimize
@databases='SentryOne',
@FragmentationLow = NULL,
@FragmentationMedium = NULL,
@FragmentationHigh = NULL,
@UpdateStatistics = 'ALL',
@OnlyModifiedStatistics = 'Y'

What output are you getting?
Date and time: 2024-10-30 09:47:51
Database context: [SentryOne]
Command: UPDATE STATISTICS [dbo].[PerformanceAnalysisDataRollup12] [_WA_Sys_00000007_79A8DF5A] WITH RESAMPLE, NORECOMPUTE ON PARTITIONS(1)
Comment: ObjectType: Table, IndexType: Column, Incremental: Y, RowCount: 2146316, ModificationCounter: 39551883679863
Msg 50000, Level 16, State 1, Procedure dbo.CommandExecute, Line 234 [Batch Start Line 0]
Msg 155, 'NORECOMPUTE' is not a recognized UPDATE STATISTICS option.
Outcome: Failed
Duration: 00:00:00
Date and time: 2024-10-30 09:47:51

The order of the options in the UPDATE STATISTICS command is wrong. If the command would be like this, it would be working:
UPDATE STATISTICS [dbo].[PerformanceAnalysisDataRollup12] [_WA_Sys_00000007_79A8DF5A] WITH RESAMPLE, NORECOMPUTE ON PARTITIONS(1)

@griffitmatt
Copy link

Hi Bernaludo

I have been able to reproduce the error as well.

Changing the order of the command will resolve the issue. ie norecompute first followed by recompile.

UPDATE STATISTICS [dbo].[PerformanceAnalysisDataRollup12] [_WA_Sys_00000007_79A8DF5A] WITH
NORECOMPUTE,RESAMPLE, ON PARTITIONS(1)

Have a look here for the workaround. - #285

@olahallengren
Copy link
Owner

This issue has been fixed in #872. Thank you for reporting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants