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

Update Statistics on Partitioned Table - getting 'NORECOMPUTE' is not a recognized #285

Open
ShakerGit opened this issue Sep 18, 2019 · 9 comments

Comments

@ShakerGit
Copy link

Description of the issue
Getting 'NORECOMPUTE' is not a recognized UPDATE STATISTICS option when running IndexOptimize on partitioned Table.
UPDATE STATISTICS [xyzdb].[dbo].[xyzTBL] [_WA_Sys_00000005_206A9855] WITH RESAMPLE, NORECOMPUTE ON PARTITIONS(1)

If I manually run the command switching the NORECOMPUTE and RESAMPLE options as below then it runs fine.
UPDATE STATISTICS [xyzdb].[dbo].[xyzTBL] [_WA_Sys_00000005_206A9855] WITH NORECOMPUTE, RESAMPLE ON PARTITIONS(1)

SQL Server version and edition
Execute SELECT @@VERSION
Microsoft SQL Server 2017 (RTM-CU16) (KB4508218) - 14.0.3223.3 (X64) Jul 12 2019 17:43:08 Copyright (C) 2017 Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2016 Standard 10.0 (Build 14393: )

Version of the script
Check the header of the stored procedure
Version: 2019-06-14 00:05:34

What command are you executing?
IndexOptimize
UPDATE STATISTICS [xyzdb].[dbo].[xyzTBL] [_WA_Sys_00000005_206A9855] WITH RESAMPLE, NORECOMPUTE ON PARTITIONS(1)

What output are you getting?
Msg Msg 155, 'NORECOMPUTE' is not a recognized UPDATE STATISTICS option.

@olahallengren olahallengren self-assigned this Dec 29, 2019
@olahallengren olahallengren removed their assignment Jan 11, 2020
@ShakerGit
Copy link
Author

For now, changed the IndexOptimize to Insert the NORECOMPUTE argument before the RESAMPLE argument.

     IF @CurrentNoRecompute = 1
      BEGIN
        INSERT INTO @CurrentUpdateStatisticsWithClauseArguments (Argument)
        SELECT 'NORECOMPUTE'
      END

      IF @CurrentStatisticsResample = 'Y'
      BEGIN
        INSERT INTO @CurrentUpdateStatisticsWithClauseArguments (Argument)
        SELECT 'RESAMPLE'
      END

@ShakerGit ShakerGit reopened this Apr 25, 2020
@ShakerGit
Copy link
Author

Sorry, meant to just add the comment, not close the issue.

@codykonior
Copy link

codykonior commented Aug 7, 2020

I've also experienced this issue. The manual bugfix worked for me.

@dbaduff
Copy link

dbaduff commented Aug 14, 2020

This seems like such an easy fix. Why hasn't it just been added to the official release?

@codykonior
Copy link

I don’t want to speak for him but writing free software is unpaid work that never ends, making changes that he doesn’t need.

It would be nice to have one source but we really can’t demand anything.

@dbaduff
Copy link

dbaduff commented Aug 19, 2020

You are right of course. I am not trying to criticize Ola or what he chooses to focus on. Just observing that it is an easy fix. Of course, There may be ramifications when testing against all versions and environments so I should just keep quiet. I'm glad I have a solution.

@codykonior
Copy link

I had the same thoughts. My reply is as much to myself as it is to you 😅

@nanoDBA
Copy link

nanoDBA commented Jun 4, 2021

Changing IndexOptimize to Insert the NORECOMPUTE argument before the RESAMPLE argument worked for me as well per @ShakerGit 's suggestion in #285 (comment)

@EitanBlumin
Copy link

EitanBlumin commented Aug 17, 2021

I just had the same error and found this thread.
My friends, isn't this an open-source project?

If you already know how to fix this, why not just open a pull request with the fix?

By the way, this is also relevant to issue #106

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

No branches or pull requests

6 participants