NikoNeugebauer / CISL

Columnstore Indexes Scripts Library
Apache License 2.0
179 stars 54 forks source link

Order of IndexName and TableName are mismatched #32

Open tejaspan opened 4 years ago

tejaspan commented 4 years ago

Do you want to request a feature or report a bug? There are two bugs:

  1. It generated 'ALTER INDEX' statements two times.
  2. It takes previous index name for next table.

Note: We've tried it with enabling @PreciseSearch too.

What is the current behavior? Execution log as below:

MAXDOP: 0

Warning: The join order has been enforced because a local join hint is used.

Current Table: [SCHEMA_1].[TABLE_1] Warning: The join order has been enforced because a local join hint is used. Warning: The join order has been enforced because a local join hint is used. Reorganize Open Delta-Stores Location: Disk-Based alter index CCI_TABLE_1 on [SCHEMA_1].[TABLE_1] Reorganize +++++ Warning: The join order has been enforced because a local join hint is used. Reason: - Rebuild: false

SQLCommand:alter index CCI_TABLE_1 on [SCHEMA_1].[TABLE_1] reorganize alter index CCI_TABLE_1 on [SCHEMA_1].[TABLE_1] reorganize

Current Table: [SCHEMA_1].[TABLE_2] Reorganize Open Delta-Stores Location: Disk-Based alter index CCI_TABLE_2 on [SCHEMA_1].[TABLE_2] Reorganize +++++ Reason: Trimmed RowGroup Percentage Rebuild: true Rebuild Trimmed RowGroup Percentage SQLCommand:alter index CCI_TABLE_2 on [SCHEMA_1].[TABLE_2] reorganize alter index CCI_TABLE_2 on [SCHEMA_1].[TABLE_2] reorganize Executed Successfully

Current Table: [SCHEMA_2].[TABLE_3] Reorganize Open Delta-Stores Location: Disk-Based alter index CCI_TABLE_2 on [SCHEMA_2].[TABLE_3] Reorganize +++++ Msg 2727, Level 11, State 1, Line 1 Cannot find index 'CCI_TABLE_2'.

Note: I've to change index, schema and table name due to confidentiality.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via http://sqlfiddle.com/ exec dbo.cstore_doMaintenance @execute = 1, @debug = 1; exec dbo.cstore_doMaintenance @execute = 1, @debug = 1, @SchemaName = 'SCHEMA_1';

What is the expected behavior? The order of IndexName and TableName should be in order and matched with Object_Id

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures? We've tried it with Azure managed database and SQL 2019 onPrem.

Please let me know if you need more information at tpanchal.brock@gmail.com

Thank you.

Regards, Tejas