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

Critical bugfixes for seemingly abandoned AdaptiveIndexDefrag #314

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

Conversation

LetsDoSQL-jdw
Copy link

v1.6.8 - 2024-08-30

  • Bugfix update statistics because of quotenames, as programmed in AndrewG2@00fef9a

v1.6.9 - 2024-08-30

  • Adding schema-names in the debug output & logging output

v1.7.0 - 2024-09-02

  • Fix update-stats for tables with more than 10B changes since last update-stats
  • Fix duration calculation
  • Fix logging update-stats of table id, schema name and table name

v1.7.1 - 2024-09-10

  • Fix for bug in official release : proactive fix for rebuilding indexes which have spaces in index names
  • Fix for bug introduced in v1.7.0: for those indexes rebuilt, the stats_log table had a null-value for objectId & objectName

Most importantly:
- Inspired by bugfix update statistics because of quotenames, as programmed in AndrewG2@00fef9a
- Fix long duration calculation
- Fix statistics modification counter for tables exceeding 10B changes since last update-stats
- Remove unnecessary brackets in the logging
- Adding schema names in the logging output & debug output
@LetsDoSQL-jdw LetsDoSQL-jdw deleted the Critical-bugfixes-for-AdaptiveIndexDefrag branch September 11, 2024 09:56
@LetsDoSQL-jdw LetsDoSQL-jdw restored the Critical-bugfixes-for-AdaptiveIndexDefrag branch September 11, 2024 10:02
@LetsDoSQL-jdw
Copy link
Author

LetsDoSQL-jdw commented Sep 13, 2024 via email

@LetsDoSQL-jdw LetsDoSQL-jdw reopened this Sep 13, 2024
@@ -1,8 +1,8 @@
-- If you are using AdaptiveIndexDefrag together with the maintenance plans in http://blogs.msdn.com/b/blogdoezequiel/archive/2012/09/18/about-maintenance-plans-grooming-sql-server.aspx
-- please note that the job that runs AdaptiveIndexDefrag is expecting msdb. As such, change the database context accordingly.

-- For deployment in Azure SQL Database, remove or comment the USE statement below.
USE msdb
-- For deployment in Azure SQL Database, remove or comment the USE statement below. And please, please don't create user objects in system databases like [msdb].
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Myeah.... I sort of agree with you when it comes to master, but msdb is a little more flexible. It's designed to store maintenance functions and metadata, and it actually needs to be user maintained or it can get out of control (something a lot of folks don't pay attention to). Also, if we were to change this here, we would have to add code to create this database elsewhere and then change all of the other scripts to use it. I'd prefer to keep this in msdb. All the other changes look good though, so if you can pull this one, I will merge the request.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look @bluefooted :) When I get back from holiday next week I will implement your proposal.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bluefooted Leave AdaptiveIndexDefrag deployed to [msdb] database. Also, I noticed that the DateDiff_Big makes that the script will be SQL2016+

As @bluefooted requested, leave AdaptiveIndexDefrag stored in msdb for flexibility purposes
Update minimum version to SQL2016 because of datediff_big
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.

2 participants