From 387dde79ce8b57f781b45bdde802dff980c2db9d Mon Sep 17 00:00:00 2001 From: Sergey Syrovatchenko Date: Sun, 31 May 2020 11:53:58 +0300 Subject: [PATCH] Move heaps to CCL indexes, new filter options --- Forms/ActionBox.cs | 4 + Forms/MainBox.cs | 12 +- Forms/SettingsBox.Designer.cs | 201 ++++++++++++++++++++++++---------- Forms/SettingsBox.cs | 9 +- Forms/SettingsBox.resx | 3 + Program.cs | 1 - Properties/AssemblyInfo.cs | 4 +- Server/Index.cs | 5 +- Server/Query.cs | 8 +- Server/QueryEngine.cs | 65 ++++++----- Settings/Options.cs | 13 +++ Types/IndexOp.cs | 5 +- 12 files changed, 231 insertions(+), 99 deletions(-) diff --git a/Forms/ActionBox.cs b/Forms/ActionBox.cs index 7d3d5cd..958b0e9 100644 --- a/Forms/ActionBox.cs +++ b/Forms/ActionBox.cs @@ -25,6 +25,10 @@ public partial class ActionBox : XtraForm { IndexOp.REBUILD_COLUMNSTORE_ARCHIVE } ); + + if (Settings.ServerInfo.MajorVersion >= ServerVersion.Sql2016) { + indexOps.Add(IndexOp.CREATE_COLUMNSTORE_INDEX); + } } if (Settings.ServerInfo.IsOnlineRebuildAvailable) { diff --git a/Forms/MainBox.cs b/Forms/MainBox.cs index 9f691da..4865740 100644 --- a/Forms/MainBox.cs +++ b/Forms/MainBox.cs @@ -605,6 +605,10 @@ public partial class MainBox : RibbonForm { ? IndexOp.REBUILD_ROW : IndexOp.REBUILD_PAGE); } + + if (!ix.IsPartitioned && ix.IndexType == IndexType.HEAP && Settings.ServerInfo.MajorVersion >= ServerVersion.Sql2016) { + i.Add(IndexOp.CREATE_COLUMNSTORE_INDEX); + } } if (ix.IsAllowOnlineRebuild) @@ -691,9 +695,6 @@ public partial class MainBox : RibbonForm { } private void GridPopupMenuShowing(object sender, PopupMenuShowingEventArgs e) { - var col = e.HitInfo.Column; - if (col == null) return; - if (e.MenuType == GridMenuType.Column) { string[] columns = { GridLocalizer.Active.GetLocalizedString(GridStringId.MenuColumnGroup), @@ -704,7 +705,12 @@ public partial class MainBox : RibbonForm { if (columns.Contains(item.Caption)) item.Visible = false; } + } + var col = e.HitInfo.Column; + if (col == null) return; + + if (e.MenuType == GridMenuType.Column) { if (col.Caption == Resources.Selection || col.Caption == Resources.Progress) return; diff --git a/Forms/SettingsBox.Designer.cs b/Forms/SettingsBox.Designer.cs index a1ad69e..d298f1c 100644 --- a/Forms/SettingsBox.Designer.cs +++ b/Forms/SettingsBox.Designer.cs @@ -37,6 +37,7 @@ partial class SettingsBox { DevExpress.XtraEditors.LabelControl labelControl6; DevExpress.XtraEditors.GroupControl db3; DevExpress.XtraEditors.GroupControl groupControl3; + DevExpress.XtraEditors.LabelControl labelControl1; DevExpress.XtraEditors.LabelControl labelControl3; DevExpress.XtraEditors.LabelControl labelPadIndex; DevExpress.XtraEditors.LabelControl labelControl7; @@ -63,6 +64,8 @@ partial class SettingsBox { this.labelSize = new DevExpress.XtraEditors.LabelControl(); this.boxConnectionTimeout = new DevExpress.XtraEditors.SpinEdit(); this.boxCommandTimeout = new DevExpress.XtraEditors.SpinEdit(); + this.boxShowOnlyMore1000Rows = new DevExpress.XtraEditors.CheckEdit(); + this.boxIgnoreHeapWithCompression = new DevExpress.XtraEditors.CheckEdit(); this.boxIgnorePermissions = new DevExpress.XtraEditors.CheckEdit(); this.boxScanMissingIndex = new DevExpress.XtraEditors.CheckEdit(); this.boxScanNonClusteredIndex = new DevExpress.XtraEditors.CheckEdit(); @@ -72,6 +75,7 @@ partial class SettingsBox { this.boxIgnoreReadOnlyFL = new DevExpress.XtraEditors.CheckEdit(); this.boxScanHeap = new DevExpress.XtraEditors.CheckEdit(); this.boxDelayAfterFix = new DevExpress.XtraEditors.SpinEdit(); + this.boxMultiThreadingCount = new DevExpress.XtraEditors.SpinEdit(); this.boxPadIndex = new DevExpress.XtraEditors.CheckEdit(); this.boxNoRecompute = new DevExpress.XtraEditors.ComboBoxEdit(); this.boxStatsSamplePercent = new DevExpress.XtraEditors.SpinEdit(); @@ -106,6 +110,7 @@ partial class SettingsBox { labelControl6 = new DevExpress.XtraEditors.LabelControl(); db3 = new DevExpress.XtraEditors.GroupControl(); groupControl3 = new DevExpress.XtraEditors.GroupControl(); + labelControl1 = new DevExpress.XtraEditors.LabelControl(); labelControl3 = new DevExpress.XtraEditors.LabelControl(); labelPadIndex = new DevExpress.XtraEditors.LabelControl(); labelControl7 = new DevExpress.XtraEditors.LabelControl(); @@ -136,6 +141,8 @@ partial class SettingsBox { ((System.ComponentModel.ISupportInitialize)(this.boxCommandTimeout.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(db3)).BeginInit(); db3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.boxShowOnlyMore1000Rows.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.boxIgnoreHeapWithCompression.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.boxIgnorePermissions.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.boxScanMissingIndex.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.boxScanNonClusteredIndex.Properties)).BeginInit(); @@ -147,6 +154,7 @@ partial class SettingsBox { ((System.ComponentModel.ISupportInitialize)(groupControl3)).BeginInit(); groupControl3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.boxDelayAfterFix.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.boxMultiThreadingCount.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.boxPadIndex.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.boxNoRecompute.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.boxStatsSamplePercent.Properties)).BeginInit(); @@ -219,7 +227,7 @@ partial class SettingsBox { // buttonCancel.AllowFocus = false; buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - buttonCancel.Location = new System.Drawing.Point(629, 511); + buttonCancel.Location = new System.Drawing.Point(642, 542); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new System.Drawing.Size(75, 23); buttonCancel.TabIndex = 0; @@ -229,7 +237,7 @@ partial class SettingsBox { // buttonRestore // buttonRestore.AllowFocus = false; - buttonRestore.Location = new System.Drawing.Point(12, 511); + buttonRestore.Location = new System.Drawing.Point(12, 542); buttonRestore.Name = "buttonRestore"; buttonRestore.Size = new System.Drawing.Size(75, 23); buttonRestore.TabIndex = 0; @@ -400,9 +408,9 @@ partial class SettingsBox { groupControl2.Controls.Add(this.boxConnectionTimeout); groupControl2.Controls.Add(labelControl6); groupControl2.Controls.Add(this.boxCommandTimeout); - groupControl2.Location = new System.Drawing.Point(414, 422); + groupControl2.Location = new System.Drawing.Point(414, 453); groupControl2.Name = "groupControl2"; - groupControl2.Size = new System.Drawing.Size(290, 81); + groupControl2.Size = new System.Drawing.Size(303, 81); groupControl2.TabIndex = 14; groupControl2.Text = "Timeout"; // @@ -421,7 +429,7 @@ partial class SettingsBox { 0, 0, 0}); - this.boxConnectionTimeout.Location = new System.Drawing.Point(189, 22); + this.boxConnectionTimeout.Location = new System.Drawing.Point(200, 22); this.boxConnectionTimeout.Name = "boxConnectionTimeout"; this.boxConnectionTimeout.Properties.AllowFocused = false; this.boxConnectionTimeout.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; @@ -464,7 +472,7 @@ partial class SettingsBox { 0, 0, 0}); - this.boxCommandTimeout.Location = new System.Drawing.Point(189, 50); + this.boxCommandTimeout.Location = new System.Drawing.Point(200, 50); this.boxCommandTimeout.Name = "boxCommandTimeout"; this.boxCommandTimeout.Properties.AllowFocused = false; this.boxCommandTimeout.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; @@ -494,6 +502,8 @@ partial class SettingsBox { // // db3 // + db3.Controls.Add(this.boxShowOnlyMore1000Rows); + db3.Controls.Add(this.boxIgnoreHeapWithCompression); db3.Controls.Add(this.boxIgnorePermissions); db3.Controls.Add(this.boxScanMissingIndex); db3.Controls.Add(this.boxScanNonClusteredIndex); @@ -504,26 +514,46 @@ partial class SettingsBox { db3.Controls.Add(this.boxScanHeap); db3.Location = new System.Drawing.Point(12, 215); db3.Name = "db3"; - db3.Size = new System.Drawing.Size(396, 114); + db3.Size = new System.Drawing.Size(396, 145); db3.TabIndex = 16; db3.Text = "Object Scan"; // + // boxShowOnlyMore1000Rows + // + this.boxShowOnlyMore1000Rows.Location = new System.Drawing.Point(228, 115); + this.boxShowOnlyMore1000Rows.Name = "boxShowOnlyMore1000Rows"; + this.boxShowOnlyMore1000Rows.Properties.AllowFocused = false; + this.boxShowOnlyMore1000Rows.Properties.Caption = " ONLY WHEN ROWS > 1000"; + this.boxShowOnlyMore1000Rows.Size = new System.Drawing.Size(154, 19); + this.boxShowOnlyMore1000Rows.TabIndex = 16; + this.boxShowOnlyMore1000Rows.TabStop = false; + // + // boxIgnoreHeapWithCompression + // + this.boxIgnoreHeapWithCompression.Location = new System.Drawing.Point(13, 115); + this.boxIgnoreHeapWithCompression.Name = "boxIgnoreHeapWithCompression"; + this.boxIgnoreHeapWithCompression.Properties.AllowFocused = false; + this.boxIgnoreHeapWithCompression.Properties.Caption = " IGNORE HEAP WITH COMPRESSION"; + this.boxIgnoreHeapWithCompression.Size = new System.Drawing.Size(200, 19); + this.boxIgnoreHeapWithCompression.TabIndex = 15; + this.boxIgnoreHeapWithCompression.TabStop = false; + // // boxIgnorePermissions // - this.boxIgnorePermissions.Location = new System.Drawing.Point(211, 84); + this.boxIgnorePermissions.Location = new System.Drawing.Point(209, 87); this.boxIgnorePermissions.Name = "boxIgnorePermissions"; this.boxIgnorePermissions.Properties.AllowFocused = false; - this.boxIgnorePermissions.Properties.Caption = "IGNORE OBJECT PERMISSIONS"; - this.boxIgnorePermissions.Size = new System.Drawing.Size(170, 19); + this.boxIgnorePermissions.Properties.Caption = " IGNORE OBJECT PERMISSIONS"; + this.boxIgnorePermissions.Size = new System.Drawing.Size(173, 19); this.boxIgnorePermissions.TabIndex = 11; this.boxIgnorePermissions.TabStop = false; // // boxScanMissingIndex // - this.boxScanMissingIndex.Location = new System.Drawing.Point(287, 25); + this.boxScanMissingIndex.Location = new System.Drawing.Point(286, 26); this.boxScanMissingIndex.Name = "boxScanMissingIndex"; this.boxScanMissingIndex.Properties.AllowFocused = false; - this.boxScanMissingIndex.Properties.Caption = "MISSING INDEX"; + this.boxScanMissingIndex.Properties.Caption = " MISSING INDEX"; this.boxScanMissingIndex.Size = new System.Drawing.Size(97, 19); this.boxScanMissingIndex.TabIndex = 14; this.boxScanMissingIndex.TabStop = false; @@ -531,10 +561,10 @@ partial class SettingsBox { // // boxScanNonClusteredIndex // - this.boxScanNonClusteredIndex.Location = new System.Drawing.Point(166, 25); + this.boxScanNonClusteredIndex.Location = new System.Drawing.Point(166, 26); this.boxScanNonClusteredIndex.Name = "boxScanNonClusteredIndex"; this.boxScanNonClusteredIndex.Properties.AllowFocused = false; - this.boxScanNonClusteredIndex.Properties.Caption = "NON-CLUSTERED"; + this.boxScanNonClusteredIndex.Properties.Caption = " NON-CLUSTERED"; this.boxScanNonClusteredIndex.Size = new System.Drawing.Size(105, 19); this.boxScanNonClusteredIndex.TabIndex = 5; this.boxScanNonClusteredIndex.TabStop = false; @@ -542,10 +572,10 @@ partial class SettingsBox { // // boxScanClusteredIndex // - this.boxScanClusteredIndex.Location = new System.Drawing.Point(72, 25); + this.boxScanClusteredIndex.Location = new System.Drawing.Point(72, 26); this.boxScanClusteredIndex.Name = "boxScanClusteredIndex"; this.boxScanClusteredIndex.Properties.AllowFocused = false; - this.boxScanClusteredIndex.Properties.Caption = "CLUSTERED"; + this.boxScanClusteredIndex.Properties.Caption = " CLUSTERED"; this.boxScanClusteredIndex.Size = new System.Drawing.Size(83, 19); this.boxScanClusteredIndex.TabIndex = 4; this.boxScanClusteredIndex.TabStop = false; @@ -553,10 +583,10 @@ partial class SettingsBox { // // boxScanClusteredColumnstore // - this.boxScanClusteredColumnstore.Location = new System.Drawing.Point(13, 54); + this.boxScanClusteredColumnstore.Location = new System.Drawing.Point(13, 56); this.boxScanClusteredColumnstore.Name = "boxScanClusteredColumnstore"; this.boxScanClusteredColumnstore.Properties.AllowFocused = false; - this.boxScanClusteredColumnstore.Properties.Caption = "CLUSTERED COLUMNSTORE"; + this.boxScanClusteredColumnstore.Properties.Caption = " CLUSTERED COLUMNSTORE"; this.boxScanClusteredColumnstore.Size = new System.Drawing.Size(160, 19); this.boxScanClusteredColumnstore.TabIndex = 3; this.boxScanClusteredColumnstore.TabStop = false; @@ -564,31 +594,31 @@ partial class SettingsBox { // // boxScanNonClusteredColumnstore // - this.boxScanNonClusteredColumnstore.Location = new System.Drawing.Point(202, 54); + this.boxScanNonClusteredColumnstore.Location = new System.Drawing.Point(199, 56); this.boxScanNonClusteredColumnstore.Name = "boxScanNonClusteredColumnstore"; this.boxScanNonClusteredColumnstore.Properties.AllowFocused = false; - this.boxScanNonClusteredColumnstore.Properties.Caption = "NON-CLUSTERED COLUMNSTORE"; - this.boxScanNonClusteredColumnstore.Size = new System.Drawing.Size(183, 19); + this.boxScanNonClusteredColumnstore.Properties.Caption = " NON-CLUSTERED COLUMNSTORE"; + this.boxScanNonClusteredColumnstore.Size = new System.Drawing.Size(185, 19); this.boxScanNonClusteredColumnstore.TabIndex = 2; this.boxScanNonClusteredColumnstore.TabStop = false; this.boxScanNonClusteredColumnstore.CheckedChanged += new System.EventHandler(this.IndexTypeCheckedChanged); // // boxIgnoreReadOnlyFL // - this.boxIgnoreReadOnlyFL.Location = new System.Drawing.Point(13, 83); + this.boxIgnoreReadOnlyFL.Location = new System.Drawing.Point(13, 86); this.boxIgnoreReadOnlyFL.Name = "boxIgnoreReadOnlyFL"; this.boxIgnoreReadOnlyFL.Properties.AllowFocused = false; - this.boxIgnoreReadOnlyFL.Properties.Caption = "IGNORE READ-ONLY FILEGROUPS"; - this.boxIgnoreReadOnlyFL.Size = new System.Drawing.Size(185, 19); + this.boxIgnoreReadOnlyFL.Properties.Caption = " IGNORE READ-ONLY FILEGROUPS"; + this.boxIgnoreReadOnlyFL.Size = new System.Drawing.Size(189, 19); this.boxIgnoreReadOnlyFL.TabIndex = 10; this.boxIgnoreReadOnlyFL.TabStop = false; // // boxScanHeap // - this.boxScanHeap.Location = new System.Drawing.Point(13, 25); + this.boxScanHeap.Location = new System.Drawing.Point(13, 26); this.boxScanHeap.Name = "boxScanHeap"; this.boxScanHeap.Properties.AllowFocused = false; - this.boxScanHeap.Properties.Caption = "HEAP"; + this.boxScanHeap.Properties.Caption = " HEAP"; this.boxScanHeap.Size = new System.Drawing.Size(65, 19); this.boxScanHeap.TabIndex = 1; this.boxScanHeap.TabStop = false; @@ -597,6 +627,8 @@ partial class SettingsBox { // groupControl3 // groupControl3.Controls.Add(this.boxDelayAfterFix); + groupControl3.Controls.Add(labelControl1); + groupControl3.Controls.Add(this.boxMultiThreadingCount); groupControl3.Controls.Add(labelControl3); groupControl3.Controls.Add(labelPadIndex); groupControl3.Controls.Add(this.boxPadIndex); @@ -626,7 +658,7 @@ partial class SettingsBox { groupControl3.Controls.Add(this.boxOnline); groupControl3.Location = new System.Drawing.Point(414, 4); groupControl3.Name = "groupControl3"; - groupControl3.Size = new System.Drawing.Size(290, 412); + groupControl3.Size = new System.Drawing.Size(303, 443); groupControl3.TabIndex = 17; groupControl3.Text = "Indexes"; // @@ -637,7 +669,7 @@ partial class SettingsBox { 0, 0, 0}); - this.boxDelayAfterFix.Location = new System.Drawing.Point(189, 383); + this.boxDelayAfterFix.Location = new System.Drawing.Point(200, 413); this.boxDelayAfterFix.Name = "boxDelayAfterFix"; this.boxDelayAfterFix.Properties.AllowFocused = false; this.boxDelayAfterFix.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; @@ -662,16 +694,59 @@ partial class SettingsBox { 0, 0}); this.boxDelayAfterFix.Size = new System.Drawing.Size(88, 20); - this.boxDelayAfterFix.TabIndex = 30; + this.boxDelayAfterFix.TabIndex = 32; this.boxDelayAfterFix.TabStop = false; // + // labelControl1 + // + labelControl1.Location = new System.Drawing.Point(14, 416); + labelControl1.Name = "labelControl1"; + labelControl1.Size = new System.Drawing.Size(122, 13); + labelControl1.TabIndex = 31; + labelControl1.Text = "DELAY_MS_AFTER_FIX ="; + // + // boxMultiThreadingCount + // + this.boxMultiThreadingCount.EditValue = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.boxMultiThreadingCount.Location = new System.Drawing.Point(200, 383); + this.boxMultiThreadingCount.Name = "boxMultiThreadingCount"; + this.boxMultiThreadingCount.Properties.AllowFocused = false; + this.boxMultiThreadingCount.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; + this.boxMultiThreadingCount.Properties.Appearance.Options.UseTextOptions = true; + this.boxMultiThreadingCount.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; + this.boxMultiThreadingCount.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.boxMultiThreadingCount.Properties.DisplayFormat.FormatString = "N00"; + this.boxMultiThreadingCount.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom; + this.boxMultiThreadingCount.Properties.EditFormat.FormatString = "n0"; + this.boxMultiThreadingCount.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Custom; + this.boxMultiThreadingCount.Properties.IsFloatValue = false; + this.boxMultiThreadingCount.Properties.Mask.EditMask = "N00"; + this.boxMultiThreadingCount.Properties.MaxValue = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.boxMultiThreadingCount.Properties.MinValue = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.boxMultiThreadingCount.Size = new System.Drawing.Size(88, 20); + this.boxMultiThreadingCount.TabIndex = 30; + this.boxMultiThreadingCount.TabStop = false; + // // labelControl3 // - labelControl3.Location = new System.Drawing.Point(14, 384); + labelControl3.Location = new System.Drawing.Point(14, 386); labelControl3.Name = "labelControl3"; - labelControl3.Size = new System.Drawing.Size(122, 13); + labelControl3.Size = new System.Drawing.Size(173, 13); labelControl3.TabIndex = 28; - labelControl3.Text = "DELAY_MS_AFTER_FIX ="; + labelControl3.Text = "MULTI-THREADING_PROCESSING ="; // // labelPadIndex // @@ -683,7 +758,7 @@ partial class SettingsBox { // // boxPadIndex // - this.boxPadIndex.Location = new System.Drawing.Point(221, 186); + this.boxPadIndex.Location = new System.Drawing.Point(230, 186); this.boxPadIndex.Name = "boxPadIndex"; this.boxPadIndex.Properties.AllowFocused = false; this.boxPadIndex.Properties.Caption = ""; @@ -694,7 +769,7 @@ partial class SettingsBox { // boxNoRecompute // this.boxNoRecompute.EditValue = ""; - this.boxNoRecompute.Location = new System.Drawing.Point(189, 354); + this.boxNoRecompute.Location = new System.Drawing.Point(200, 354); this.boxNoRecompute.Name = "boxNoRecompute"; this.boxNoRecompute.Properties.AllowFocused = false; this.boxNoRecompute.Properties.Appearance.Options.UseTextOptions = true; @@ -724,7 +799,7 @@ partial class SettingsBox { // // labelControl15 // - labelControl15.Location = new System.Drawing.Point(14, 356); + labelControl15.Location = new System.Drawing.Point(14, 357); labelControl15.Name = "labelControl15"; labelControl15.Size = new System.Drawing.Size(151, 13); labelControl15.TabIndex = 20; @@ -737,7 +812,7 @@ partial class SettingsBox { 0, 0, 0}); - this.boxStatsSamplePercent.Location = new System.Drawing.Point(189, 325); + this.boxStatsSamplePercent.Location = new System.Drawing.Point(200, 325); this.boxStatsSamplePercent.Name = "boxStatsSamplePercent"; this.boxStatsSamplePercent.Properties.AllowFocused = false; this.boxStatsSamplePercent.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; @@ -768,7 +843,7 @@ partial class SettingsBox { // boxScanMode // this.boxScanMode.EditValue = ""; - this.boxScanMode.Location = new System.Drawing.Point(189, 22); + this.boxScanMode.Location = new System.Drawing.Point(200, 22); this.boxScanMode.Name = "boxScanMode"; this.boxScanMode.Properties.AllowFocused = false; this.boxScanMode.Properties.Appearance.Options.UseTextOptions = true; @@ -782,7 +857,7 @@ partial class SettingsBox { // // boxLobCompaction // - this.boxLobCompaction.Location = new System.Drawing.Point(221, 135); + this.boxLobCompaction.Location = new System.Drawing.Point(230, 135); this.boxLobCompaction.Name = "boxLobCompaction"; this.boxLobCompaction.Properties.AllowFocused = false; this.boxLobCompaction.Properties.Caption = ""; @@ -793,7 +868,7 @@ partial class SettingsBox { // boxDataCompression // this.boxDataCompression.EditValue = ""; - this.boxDataCompression.Location = new System.Drawing.Point(189, 50); + this.boxDataCompression.Location = new System.Drawing.Point(200, 50); this.boxDataCompression.Name = "boxDataCompression"; this.boxDataCompression.Properties.AllowFocused = false; this.boxDataCompression.Properties.Appearance.Options.UseTextOptions = true; @@ -807,7 +882,7 @@ partial class SettingsBox { // // boxSortInTempDb // - this.boxSortInTempDb.Location = new System.Drawing.Point(221, 160); + this.boxSortInTempDb.Location = new System.Drawing.Point(230, 160); this.boxSortInTempDb.Name = "boxSortInTempDb"; this.boxSortInTempDb.Properties.AllowFocused = false; this.boxSortInTempDb.Properties.Caption = ""; @@ -830,7 +905,7 @@ partial class SettingsBox { 0, 0, 0}); - this.boxFillFactor.Location = new System.Drawing.Point(189, 78); + this.boxFillFactor.Location = new System.Drawing.Point(200, 78); this.boxFillFactor.Name = "boxFillFactor"; this.boxFillFactor.Properties.AllowFocused = false; this.boxFillFactor.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; @@ -860,7 +935,7 @@ partial class SettingsBox { 0, 0, 0}); - this.boxMaxDuration.Location = new System.Drawing.Point(189, 269); + this.boxMaxDuration.Location = new System.Drawing.Point(200, 269); this.boxMaxDuration.Name = "boxMaxDuration"; this.boxMaxDuration.Properties.AllowFocused = false; this.boxMaxDuration.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; @@ -891,7 +966,7 @@ partial class SettingsBox { // boxAbortAfterWait // this.boxAbortAfterWait.EditValue = ""; - this.boxAbortAfterWait.Location = new System.Drawing.Point(189, 297); + this.boxAbortAfterWait.Location = new System.Drawing.Point(200, 297); this.boxAbortAfterWait.Name = "boxAbortAfterWait"; this.boxAbortAfterWait.Properties.AllowFocused = false; this.boxAbortAfterWait.Properties.Appearance.Options.UseTextOptions = true; @@ -918,7 +993,7 @@ partial class SettingsBox { 0, 0, 0}); - this.boxMaxDod.Location = new System.Drawing.Point(189, 106); + this.boxMaxDod.Location = new System.Drawing.Point(200, 106); this.boxMaxDod.Name = "boxMaxDod"; this.boxMaxDod.Properties.AllowFocused = false; this.boxMaxDod.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; @@ -951,7 +1026,7 @@ partial class SettingsBox { // // boxWaitAtLowPriority // - this.boxWaitAtLowPriority.Location = new System.Drawing.Point(221, 239); + this.boxWaitAtLowPriority.Location = new System.Drawing.Point(230, 239); this.boxWaitAtLowPriority.Name = "boxWaitAtLowPriority"; this.boxWaitAtLowPriority.Properties.AllowFocused = false; this.boxWaitAtLowPriority.Properties.Caption = ""; @@ -969,7 +1044,7 @@ partial class SettingsBox { // // boxOnline // - this.boxOnline.Location = new System.Drawing.Point(221, 212); + this.boxOnline.Location = new System.Drawing.Point(230, 212); this.boxOnline.Name = "boxOnline"; this.boxOnline.Properties.AllowFocused = false; this.boxOnline.Properties.Caption = ""; @@ -980,7 +1055,7 @@ partial class SettingsBox { // pictureBox2 // pictureBox2.Image = global::SQLIndexManager.Properties.Resources.icon_exclude; - pictureBox2.Location = new System.Drawing.Point(13, 49); + pictureBox2.Location = new System.Drawing.Point(12, 49); pictureBox2.Name = "pictureBox2"; pictureBox2.Size = new System.Drawing.Size(20, 20); pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -990,7 +1065,7 @@ partial class SettingsBox { // pictureBox1 // pictureBox1.Image = global::SQLIndexManager.Properties.Resources.icon_include; - pictureBox1.Location = new System.Drawing.Point(13, 23); + pictureBox1.Location = new System.Drawing.Point(12, 23); pictureBox1.Name = "pictureBox1"; pictureBox1.Size = new System.Drawing.Size(20, 20); pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -1000,7 +1075,7 @@ partial class SettingsBox { // pictureBox3 // pictureBox3.Image = global::SQLIndexManager.Properties.Resources.icon_exclude; - pictureBox3.Location = new System.Drawing.Point(13, 49); + pictureBox3.Location = new System.Drawing.Point(12, 49); pictureBox3.Name = "pictureBox3"; pictureBox3.Size = new System.Drawing.Size(20, 20); pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -1010,7 +1085,7 @@ partial class SettingsBox { // pictureBox4 // pictureBox4.Image = global::SQLIndexManager.Properties.Resources.icon_include; - pictureBox4.Location = new System.Drawing.Point(13, 23); + pictureBox4.Location = new System.Drawing.Point(12, 23); pictureBox4.Name = "pictureBox4"; pictureBox4.Size = new System.Drawing.Size(20, 20); pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -1019,7 +1094,7 @@ partial class SettingsBox { // // boxIncludeSchemas // - this.boxIncludeSchemas.Location = new System.Drawing.Point(39, 23); + this.boxIncludeSchemas.Location = new System.Drawing.Point(38, 23); this.boxIncludeSchemas.Name = "boxIncludeSchemas"; this.boxIncludeSchemas.Properties.AutoHeightMode = DevExpress.XtraEditors.TokenEditAutoHeightMode.RestrictedExpand; this.boxIncludeSchemas.Properties.EditMode = DevExpress.XtraEditors.TokenEditMode.Manual; @@ -1038,7 +1113,7 @@ partial class SettingsBox { // // boxExcludeObject // - this.boxExcludeObject.Location = new System.Drawing.Point(39, 50); + this.boxExcludeObject.Location = new System.Drawing.Point(38, 50); this.boxExcludeObject.Name = "boxExcludeObject"; this.boxExcludeObject.Properties.AutoHeightMode = DevExpress.XtraEditors.TokenEditAutoHeightMode.RestrictedExpand; this.boxExcludeObject.Properties.EditMode = DevExpress.XtraEditors.TokenEditMode.Manual; @@ -1057,7 +1132,7 @@ partial class SettingsBox { // // boxExcludeSchemas // - this.boxExcludeSchemas.Location = new System.Drawing.Point(39, 49); + this.boxExcludeSchemas.Location = new System.Drawing.Point(38, 49); this.boxExcludeSchemas.Name = "boxExcludeSchemas"; this.boxExcludeSchemas.Properties.AutoHeightMode = DevExpress.XtraEditors.TokenEditAutoHeightMode.RestrictedExpand; this.boxExcludeSchemas.Properties.EditMode = DevExpress.XtraEditors.TokenEditMode.Manual; @@ -1078,7 +1153,7 @@ partial class SettingsBox { // this.buttonOK.AllowFocus = false; this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOK.Location = new System.Drawing.Point(548, 511); + this.buttonOK.Location = new System.Drawing.Point(561, 542); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.TabIndex = 1; @@ -1087,7 +1162,7 @@ partial class SettingsBox { // // boxIncludeObject // - this.boxIncludeObject.Location = new System.Drawing.Point(39, 23); + this.boxIncludeObject.Location = new System.Drawing.Point(38, 23); this.boxIncludeObject.Name = "boxIncludeObject"; this.boxIncludeObject.Properties.AutoHeightMode = DevExpress.XtraEditors.TokenEditAutoHeightMode.RestrictedExpand; this.boxIncludeObject.Properties.EditMode = DevExpress.XtraEditors.TokenEditMode.Manual; @@ -1110,7 +1185,7 @@ partial class SettingsBox { this.groupControl4.Controls.Add(pictureBox1); this.groupControl4.Controls.Add(this.boxExcludeSchemas); this.groupControl4.Controls.Add(this.boxIncludeSchemas); - this.groupControl4.Location = new System.Drawing.Point(12, 335); + this.groupControl4.Location = new System.Drawing.Point(12, 366); this.groupControl4.Name = "groupControl4"; this.groupControl4.Size = new System.Drawing.Size(396, 81); this.groupControl4.TabIndex = 18; @@ -1122,7 +1197,7 @@ partial class SettingsBox { this.groupControl5.Controls.Add(pictureBox4); this.groupControl5.Controls.Add(this.boxIncludeObject); this.groupControl5.Controls.Add(this.boxExcludeObject); - this.groupControl5.Location = new System.Drawing.Point(12, 422); + this.groupControl5.Location = new System.Drawing.Point(12, 453); this.groupControl5.Name = "groupControl5"; this.groupControl5.Size = new System.Drawing.Size(396, 81); this.groupControl5.TabIndex = 19; @@ -1130,7 +1205,7 @@ partial class SettingsBox { // // boxShowSettingsWhenConnectionChanged // - this.boxShowSettingsWhenConnectionChanged.Location = new System.Drawing.Point(93, 513); + this.boxShowSettingsWhenConnectionChanged.Location = new System.Drawing.Point(93, 544); this.boxShowSettingsWhenConnectionChanged.Name = "boxShowSettingsWhenConnectionChanged"; this.boxShowSettingsWhenConnectionChanged.Properties.AllowFocused = false; this.boxShowSettingsWhenConnectionChanged.Properties.Caption = "Open dialog when connection string changed"; @@ -1142,7 +1217,7 @@ partial class SettingsBox { // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(715, 544); + this.ClientSize = new System.Drawing.Size(726, 575); this.Controls.Add(this.boxShowSettingsWhenConnectionChanged); this.Controls.Add(this.groupControl5); this.Controls.Add(this.groupControl4); @@ -1181,6 +1256,8 @@ partial class SettingsBox { ((System.ComponentModel.ISupportInitialize)(this.boxCommandTimeout.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(db3)).EndInit(); db3.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.boxShowOnlyMore1000Rows.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.boxIgnoreHeapWithCompression.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.boxIgnorePermissions.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.boxScanMissingIndex.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.boxScanNonClusteredIndex.Properties)).EndInit(); @@ -1193,6 +1270,7 @@ partial class SettingsBox { groupControl3.ResumeLayout(false); groupControl3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.boxDelayAfterFix.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.boxMultiThreadingCount.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.boxPadIndex.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.boxNoRecompute.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.boxStatsSamplePercent.Properties)).EndInit(); @@ -1268,7 +1346,10 @@ partial class SettingsBox { private DevExpress.XtraEditors.CheckEdit boxPadIndex; private DevExpress.XtraEditors.LabelControl labelSkipThreshold; private DevExpress.XtraEditors.ComboBoxEdit boxSkipThreshold; - private DevExpress.XtraEditors.SpinEdit boxDelayAfterFix; + private DevExpress.XtraEditors.SpinEdit boxMultiThreadingCount; private DevExpress.XtraEditors.CheckEdit boxShowSettingsWhenConnectionChanged; + private DevExpress.XtraEditors.CheckEdit boxIgnoreHeapWithCompression; + private DevExpress.XtraEditors.SpinEdit boxDelayAfterFix; + private DevExpress.XtraEditors.CheckEdit boxShowOnlyMore1000Rows; } } \ No newline at end of file diff --git a/Forms/SettingsBox.cs b/Forms/SettingsBox.cs index 1608216..0e65d5d 100644 --- a/Forms/SettingsBox.cs +++ b/Forms/SettingsBox.cs @@ -51,7 +51,9 @@ public partial class SettingsBox : XtraForm { boxPadIndex.Checked = o.PadIndex; boxSortInTempDb.Checked = o.SortInTempDb; boxLobCompaction.Checked = o.LobCompaction; + boxMultiThreadingCount.Value = o.DelayAfterFix; boxDelayAfterFix.Value = o.DelayAfterFix; + boxMultiThreadingCount.Value = o.MultiThreadingCount; boxMaxDod.Value = o.MaxDop; boxStatsSamplePercent.Value = o.SampleStatsPercent; boxConnectionTimeout.Value = o.ConnectionTimeout; @@ -78,6 +80,8 @@ public partial class SettingsBox : XtraForm { boxExcludeObject.EditValue = string.Join(";", o.ExcludeObject); boxIgnorePermissions.Checked = o.IgnorePermissions; boxIgnoreReadOnlyFL.Checked = o.IgnoreReadOnlyFL; + boxIgnoreHeapWithCompression.Checked = o.IgnoreHeapWithCompression; + boxShowOnlyMore1000Rows.Checked = o.ShowOnlyMore1000Rows; } public Options GetSettings() { @@ -91,6 +95,7 @@ public partial class SettingsBox : XtraForm { PreDescribeSize = boxMinIndexSize.Value.Maximum, MaxIndexSize = boxMaxIndexSize.Value, DelayAfterFix = (int)boxDelayAfterFix.Value, + MultiThreadingCount = (int)boxMultiThreadingCount.Value, MaxDop = (int)boxMaxDod.Value, Online = boxOnline.Checked, PadIndex = boxPadIndex.Checked, @@ -120,7 +125,9 @@ public partial class SettingsBox : XtraForm { IncludeObject = new List (boxIncludeObject.EditValue.ToString().Split(';')), ExcludeObject = new List (boxExcludeObject.EditValue.ToString().Split(';')), IgnorePermissions = boxIgnorePermissions.Checked, - IgnoreReadOnlyFL = boxIgnoreReadOnlyFL.Checked + IgnoreReadOnlyFL = boxIgnoreReadOnlyFL.Checked, + IgnoreHeapWithCompression = boxIgnoreHeapWithCompression.Checked, + ShowOnlyMore1000Rows = boxShowOnlyMore1000Rows.Checked }; } diff --git a/Forms/SettingsBox.resx b/Forms/SettingsBox.resx index 27ec773..b22528c 100644 --- a/Forms/SettingsBox.resx +++ b/Forms/SettingsBox.resx @@ -156,6 +156,9 @@ False + + False + False diff --git a/Program.cs b/Program.cs index 9c7d99f..686aae5 100644 --- a/Program.cs +++ b/Program.cs @@ -41,7 +41,6 @@ static class Program { SplashScreenManager.ShowForm(typeof(SplashScreenBox)); var mainBox = new MainBox(); - Thread.Sleep(100); SplashScreenManager.CloseForm(); Application.Run(mainBox); diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 0631c1d..b301711 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -7,5 +7,5 @@ [assembly: AssemblyCopyright("Sergii Syrovatchenko")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.0.0.62")] -[assembly: AssemblyFileVersion("1.0.0.62")] +[assembly: AssemblyVersion("1.0.0.63")] +[assembly: AssemblyFileVersion("1.0.0.63")] diff --git a/Server/Index.cs b/Server/Index.cs index f01d08b..81305ba 100644 --- a/Server/Index.cs +++ b/Server/Index.cs @@ -62,7 +62,10 @@ public class Index { string fullIndexName = $"{indexName} ON {objectName}"; string partition = IsPartitioned ? PartitionNumber.ToString() : "ALL"; - if (IsColumnstore) { + if (IndexType == IndexType.HEAP && FixType == IndexOp.CREATE_COLUMNSTORE_INDEX) { + sql = $"CREATE CLUSTERED COLUMNSTORE INDEX [CCL] ON {objectName} WITH (COMPRESSION_DELAY = 0, DATA_COMPRESSION = {DataCompression.COLUMNSTORE});"; + } + else if (IsColumnstore) { switch (FixType) { case IndexOp.REBUILD: diff --git a/Server/Query.cs b/Server/Query.cs index 17aee6f..a68e68b 100644 --- a/Server/Query.cs +++ b/Server/Query.cs @@ -81,7 +81,7 @@ SELECT p.ObjectID , p.[index_id] , p.[partition_number] ) p -JOIN sys.indexes i WITH(NOLOCK) ON i.[object_id] = p.ObjectID AND i.[index_id] = p.IndexID {6} +JOIN sys.indexes i WITH(NOLOCK) ON i.[object_id] = p.ObjectID AND i.[index_id] = p.IndexID {6} {8} WHERE i.[type] IN ({0}) AND i.[object_id] > 255 AND ( @@ -371,7 +371,7 @@ SELECT i.ObjectID INTO #Partitions FROM sys.partitions WITH(NOLOCK) WHERE [object_id] > 255 - AND [rows] > 0 + AND [rows] > {0} AND [object_id] NOT IN (SELECT * FROM #ExcludeList)"; public const string IncludeList = @" @@ -384,7 +384,7 @@ SELECT i.ObjectID SELECT [object_id] FROM sys.objects WITH(NOLOCK) WHERE [type] IN ('V', 'U') - {0}{1} + {1}{2} SELECT [object_id] , [index_id] @@ -395,7 +395,7 @@ SELECT i.ObjectID INTO #Partitions FROM sys.partitions WITH(NOLOCK) WHERE [object_id] > 255 - AND [rows] > 0 + AND [rows] > {0} AND [object_id] NOT IN (SELECT * FROM #ExcludeList) AND [object_id] IN (SELECT * FROM #IncludeList)"; diff --git a/Server/QueryEngine.cs b/Server/QueryEngine.cs index 8baf63c..144a512 100644 --- a/Server/QueryEngine.cs +++ b/Server/QueryEngine.cs @@ -42,20 +42,24 @@ public static class QueryEngine { } public static List GetDiskInfo(SqlConnection connection) { - SqlCommand cmd = new SqlCommand(Query.DiskInfo, connection) { CommandTimeout = Settings.Options.CommandTimeout }; + List di = new List(); - SqlDataAdapter adapter = new SqlDataAdapter(cmd); - DataSet data = new DataSet(); - adapter.Fill(data); + if (!Settings.ServerInfo.IsAzure && Settings.ServerInfo.IsSysAdmin) { + SqlCommand cmd = new SqlCommand(Query.DiskInfo, connection) { CommandTimeout = Settings.Options.CommandTimeout }; - List di = new List(); - foreach (DataRow _ in data.Tables[0].Rows) { - di.Add( - new DiskInfo { - Drive = _.Field(0), - FreeSpace = _.Field(1) - } - ); + SqlDataAdapter adapter = new SqlDataAdapter(cmd); + DataSet data = new DataSet(); + adapter.Fill(data); + + + foreach (DataRow _ in data.Tables[0].Rows) { + di.Add( + new DiskInfo { + Drive = _.Field(0), + FreeSpace = _.Field(1) + } + ); + } } return di; @@ -135,24 +139,27 @@ public static class QueryEngine { if (!string.IsNullOrEmpty(includeListObject)) includeListObject = $"AND ( 1 = 0 {includeListObject})"; + int filterRows = Settings.Options.ShowOnlyMore1000Rows ? 1000 : 0; + string includeList = string.IsNullOrEmpty(includeListSchemas) && string.IsNullOrEmpty(includeListObject) - ? Query.IncludeListEmpty - : string.Format(Query.IncludeList, includeListSchemas, includeListObject); + ? string.Format(Query.IncludeListEmpty, filterRows) + : string.Format(Query.IncludeList, filterRows, includeListSchemas, includeListObject); - string ignoreReadOnlyFL = Settings.Options.IgnoreReadOnlyFL ? "" : "AND fg.[is_read_only] = 0"; - string ignorePermissions = Settings.Options.IgnorePermissions ? "" : "AND PERMISSIONS(i.[object_id]) & 2 = 2"; + string ignoreReadOnlyFL = Settings.Options.IgnoreReadOnlyFL ? "" : "AND fg.[is_read_only] = 0 "; + string ignorePermissions = Settings.Options.IgnorePermissions ? "" : "AND PERMISSIONS(i.[object_id]) & 2 = 2 "; + string ignoreHeapWithCompression = Settings.Options.IgnoreHeapWithCompression ? "AND (i.[type] != 0 OR (i.[type] = 0 AND p.DataCompression = 0)) " : ""; string query = string.Format(Query.PreDescribeIndexes, string.Join(", ", it), excludeList, indexQuery, lob, - indexStats, ignoreReadOnlyFL, ignorePermissions, includeList); + indexStats, ignoreReadOnlyFL, ignorePermissions, includeList, ignoreHeapWithCompression); SqlCommand cmd = new SqlCommand(query, connection) { CommandTimeout = Settings.Options.CommandTimeout }; - cmd.Parameters.Add(new SqlParameter("@Fragmentation", SqlDbType.Float) { Value = threshold }); - cmd.Parameters.Add(new SqlParameter("@MinIndexSize", SqlDbType.BigInt) { Value = Settings.Options.MinIndexSize.PageSize() }); - cmd.Parameters.Add(new SqlParameter("@MaxIndexSize", SqlDbType.BigInt) { Value = Settings.Options.MaxIndexSize.PageSize() }); - cmd.Parameters.Add(new SqlParameter("@PreDescribeSize", SqlDbType.BigInt) { Value = Settings.Options.PreDescribeSize.PageSize() }); - cmd.Parameters.Add(new SqlParameter("@ScanMode", SqlDbType.NVarChar, 100) { Value = Settings.Options.ScanMode }); + cmd.Parameters.Add(new SqlParameter("@Fragmentation", SqlDbType.Float) { Value = threshold }); + cmd.Parameters.Add(new SqlParameter("@MinIndexSize", SqlDbType.BigInt) { Value = Settings.Options.MinIndexSize.PageSize() }); + cmd.Parameters.Add(new SqlParameter("@MaxIndexSize", SqlDbType.BigInt) { Value = Settings.Options.MaxIndexSize.PageSize() }); + cmd.Parameters.Add(new SqlParameter("@PreDescribeSize", SqlDbType.BigInt) { Value = Settings.Options.PreDescribeSize.PageSize() }); + cmd.Parameters.Add(new SqlParameter("@ScanMode", SqlDbType.NVarChar, 100) { Value = Settings.Options.ScanMode }); SqlDataAdapter adapter = new SqlDataAdapter(cmd); DataSet data = new DataSet(); @@ -330,8 +337,10 @@ public static class QueryEngine { } public static string FixIndex(SqlConnection connection, Index ix) { + int indexId = ix.FixType == IndexOp.CREATE_COLUMNSTORE_INDEX && ix.IndexType == IndexType.HEAP ? 1 : ix.IndexId; + string sqlInfo = string.Format(ix.IsColumnstore ? Query.AfterFixColumnstoreIndex : Query.AfterFixIndex, - ix.ObjectId, ix.IndexId, ix.PartitionNumber, Settings.Options.ScanMode); + ix.ObjectId, indexId, ix.PartitionNumber, Settings.Options.ScanMode); string query = ix.GetQuery(); string sql = ix.FixType == IndexOp.DISABLE_INDEX @@ -356,7 +365,6 @@ public static class QueryEngine { } if (string.IsNullOrEmpty(ix.Error)) { - try { if (ix.FixType == IndexOp.UPDATE_STATISTICS_FULL || ix.FixType == IndexOp.UPDATE_STATISTICS_RESAMPLE || ix.FixType == IndexOp.UPDATE_STATISTICS_SAMPLE) { ix.IndexStats = DateTime.Now; @@ -383,6 +391,11 @@ public static class QueryEngine { ix.RowsCount = row.Field(Resources.RowsCount); ix.DataCompression = ((DataCompression)row.Field(Resources.DataCompression)); ix.IndexStats = row.Field(Resources.IndexStats); + + if (ix.FixType == IndexOp.CREATE_COLUMNSTORE_INDEX) { + ix.IndexName = "CCL"; + ix.IndexType = IndexType.CLUSTERED_COLUMNSTORE; + } } } catch (Exception ex) { @@ -447,10 +460,10 @@ public static class QueryEngine { if (Settings.Options.DataCompression == DataCompression.NONE && ix.DataCompression != DataCompression.NONE) return IndexOp.REBUILD_NONE; - if (Settings.Options.DataCompression == DataCompression.ROW) + if (Settings.Options.DataCompression == DataCompression.ROW && ix.DataCompression != DataCompression.ROW) return IndexOp.REBUILD_ROW; - if (Settings.Options.DataCompression == DataCompression.PAGE) + if (Settings.Options.DataCompression == DataCompression.PAGE && ix.DataCompression != DataCompression.PAGE) return IndexOp.REBUILD_PAGE; } diff --git a/Settings/Options.cs b/Settings/Options.cs index b52c3ef..702e6d7 100644 --- a/Settings/Options.cs +++ b/Settings/Options.cs @@ -18,6 +18,7 @@ public class Options { private int _connectionTimeout = 15; private int _commandTimeout = 120; private int _delayAfterFix; + private int _multiThreadingCount = 1; private int _maxDop; private int _fillFactor; private int _sampleStatsPercent = 100; @@ -94,6 +95,12 @@ public class Options { set => _delayAfterFix = value.IsBetween(0, 5000) ? value : _delayAfterFix; } + [XmlAttribute] + public int MultiThreadingCount { + get => _multiThreadingCount; + set => _multiThreadingCount = value.IsBetween(1, 1) ? value : _multiThreadingCount; + } + [XmlAttribute] public int MaxDop { get => _maxDop; @@ -172,6 +179,12 @@ public class Options { [XmlAttribute] public bool IgnoreReadOnlyFL; + [XmlAttribute] + public bool IgnoreHeapWithCompression; + + [XmlAttribute] + public bool ShowOnlyMore1000Rows; + [XmlElement] public List IncludeSchemas { get => _includeSchemas; diff --git a/Types/IndexOp.cs b/Types/IndexOp.cs index 2f8b514..498880c 100644 --- a/Types/IndexOp.cs +++ b/Types/IndexOp.cs @@ -58,7 +58,10 @@ public enum IndexOp { IGNORE = 17, [Description("SKIP")] - SKIP = 18 + SKIP = 18, + + [Description("CREATE COLUMNSTORE INDEX")] + CREATE_COLUMNSTORE_INDEX = 19 } }