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

Polybase Stats Rebuild Fix #645

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

heaivilinn
Copy link

Per Microsoft, statistics for external tables cannot be ALTERED. If a rebuild is required, they must be dropped and re-created. As such, I've updated the code to correctly identify external tables and drop/add stats on them by default. A parameter was added that if change to anything other than REBUILD, will ignore stats maintenance work on external tables.

Added functionality to correctly update statistics on external table.  Per MS, they cannot be ALTERED.  They must be dropped and recreated.    Added variable @ExternalTables.  Default is to REBUILD external table stats.  Any additional values will be ignored.
fixes to original code to only use the current definition, rather than all columns.
@heaivilinn
Copy link
Author

@olahallengren, is there something specific I need to do to get this PR approved and merged into the core source control? Or is it just a matter of time and resources? Appreciate the update.

@steverezhener
Copy link

steverezhener commented Sep 20, 2023

@heaivilinn , great job on that index optimize code for polybase table stats. A few things missing:

  1. Need to add WITH FULLSCAN or WITH SAMPLE [0-9][0-9] PERCENT after the parenthesis line #2279. unless indexoptimize is used strictly for polybase objects with @StatisticsSample='FULL' or similar
  2. script could create stats if missing (more like an enhancement)

@heaivilin
Copy link

heaivilin commented Jan 11, 2024

@steverezhener, apologies for the very long wait on a response here. Somehow got unsubscribed and then I got pulled away on other things.

Regarding No.1, wouldn't this be handled by the @CurrentUpdateStatisticsWithClauseArguments variable that is added to @CurrentCommand on line 2347? Code seems to show it, but I'm having to rebuild my test environment as I've switched jobs and the new one doesn't use Polybase at present.

Regarding No.2, potentially, but would you want it to do this? I'd be interested in what the community thinks. Maybe something that is done, but not turned on by default as I know I wouldn't want it done by default without my knowledge.

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

Successfully merging this pull request may close these issues.

None yet

3 participants