Title: ColumnstoreOptimize @table parameter doesn't handle '-' values correctly · Issue #3 · ProdataSQL/SynapseTools · GitHub
Open Graph Title: ColumnstoreOptimize @table parameter doesn't handle '-' values correctly · Issue #3 · ProdataSQL/SynapseTools
X Title: ColumnstoreOptimize @table parameter doesn't handle '-' values correctly · Issue #3 · ProdataSQL/SynapseTools
Description: Hello! I faced an issue while I was trying to exclude a table from an entire schema on the ColumnstoreOptimize procedure (just like on StatsOptimize). Example: Command EXEC [dba].[ColumnstoreOptimize] @Tables = N'SchemaLab.%,-TableB', @D...
Open Graph Description: Hello! I faced an issue while I was trying to exclude a table from an entire schema on the ColumnstoreOptimize procedure (just like on StatsOptimize). Example: Command EXEC [dba].[ColumnstoreOptimi...
X Description: Hello! I faced an issue while I was trying to exclude a table from an entire schema on the ColumnstoreOptimize procedure (just like on StatsOptimize). Example: Command EXEC [dba].[ColumnstoreOptimi...
Opengraph URL: https://github.com/ProdataSQL/SynapseTools/issues/3
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ColumnstoreOptimize @table parameter doesn't handle '-' values correctly","articleBody":"Hello!\n\nI faced an issue while I was trying to exclude a table from an entire schema on the ColumnstoreOptimize procedure (just like on StatsOptimize).\nExample:\n\n**Command**\n```sql\nEXEC [dba].[ColumnstoreOptimize]\n @Tables = N'SchemaLab.%,-TableB',\n @DensityThreshold = 0,\n @OpenThreshold = 0,\n @DeleteThreshold = 0,\n @TimeLimit = NULL,\n @Execute = N'N';\n```\n\n**Output**\n\n\u003e Date and time: 2026-01-16 12:56:10\n\u003e Server: my-lab-workspace\n\u003e Version: 10.0.29311.0\n\u003e Edition: SQL Azure\n\u003e Parameters: @Tables= 'SchemaLab.%,-TableB', @DensityThreshold = 0.00, @OpenThreshold = 0, @DeleteThreshold = 0, @Execute = N\n\u003e Version: Microsoft Azure SQL Data Warehouse - 10.0.29311.0 Sep 9 2025 04:02:32 Copyright (c) Microsoft Corporation\n\u003e Source: https://github.com/ProdataSQL/SynapseTools/tree/main/SqlPools/Maintenance\n\u003e Date and time: 2026-01-16 12:56:14\n\u003e [SchemaLab].[TableA]\n\u003e SqlCommand: ALTER INDEX ClusteredIndex_0c9429ed384a4e268945b46059844aa7 ON [SchemaLab].[TableA] REORGANIZE WITH (COMPRESS_ALL_ROW_GROUPS = ON)\n\u003e (null)\n\u003e Date and time: 2026-01-16 12:56:14\n\u003e [SchemaLab].[TableB]\n\u003e SqlCommand: ALTER INDEX ClusteredIndex_bd57f7f732c84f6b8d17da2e280697ca ON [SchemaLab].[TableB] REORGANIZE WITH (COMPRESS_ALL_ROW_GROUPS = ON)\n\u003e (null)\n\u003e Date and time: 2026-01-16 12:56:15\n\u003e [SchemaLab].[TableC]\n\u003e SqlCommand: ALTER INDEX ClusteredIndex_66416c0fa78f49eb8b2bb59d30974002 ON [SchemaLab].[TableC] REORGANIZE WITH (COMPRESS_ALL_ROW_GROUPS = ON)\n\u003e (null)\n\nAs you can see, [SchemaLab].[TableB] wasn't excluded from the table list.\n\nI tried a change by replacing the following code:\n```sql\nParamTables as (\n select t.object_id, s.name as [Schema], t.name as [Table]\n FROM Param2 p\n CROSS JOIN sys.tables t \n INNER JOIN sys.schemas s on s.schema_id = t.schema_id\n WHERE t.type='U' and is_external=0 \n and ( s.name like p.[schema] AND t.name like p.[Table] )\n GROUP BY t.object_id , s.name, t.name\n having max(p.Op) ='+'\n)\n```\nwith:\n```sql\nParamTables AS (\n SELECT t.object_id, s.name AS [Schema], t.name AS [Table]\n FROM sys.tables t\n INNER JOIN sys.schemas s ON s.schema_id = t.schema_id\n WHERE t.type='U' AND is_external=0\n AND EXISTS (\n SELECT 1 FROM Param2 p\n WHERE p.Op = '+' \n AND ( (p.[Schema] = '%' OR s.name LIKE p.[Schema]) \n AND (p.[Table] = '%' OR t.name LIKE p.[Table]) )\n )\n AND NOT EXISTS (\n SELECT 1 FROM Param2 p\n WHERE p.Op = '-' \n AND ( (p.[Schema] = '%' OR s.name LIKE p.[Schema]) \n AND (p.[Table] = '%' OR t.name LIKE p.[Table]) )\n )\n)\n```\n\n**Output after the change:**\n\n\u003e Date and time: 2026-01-16 12:57:50\n\u003e Server: my-lab-workspace\n\u003e Version: 10.0.29311.0\n\u003e Edition: SQL Azure\n\u003e Parameters: @Tables= 'SchemaLab.%,-TableB', @DensityThreshold = 0.00, @OpenThreshold = 0, @DeleteThreshold = 0, @Execute = N\n\u003e Version: Microsoft Azure SQL Data Warehouse - 10.0.29311.0 Sep 9 2025 04:02:32 Copyright (c) Microsoft Corporation\n\u003e Source: https://github.com/ProdataSQL/SynapseTools/tree/main/SqlPools/Maintenance\n\u003e Date and time: 2026-01-16 12:57:54\n\u003e [SchemaLab].[TableA]\n\u003e SqlCommand: ALTER INDEX ClusteredIndex_0c9429ed384a4e268945b46059844aa7 ON [SchemaLab].[TableA] REORGANIZE WITH (COMPRESS_ALL_ROW_GROUPS = ON)\n\u003e (null)\n\u003e Date and time: 2026-01-16 12:57:54\n\u003e [SchemaLab].[TableC]\n\u003e SqlCommand: ALTER INDEX ClusteredIndex_66416c0fa78f49eb8b2bb59d30974002 ON [SchemaLab].[TableC] REORGANIZE WITH (COMPRESS_ALL_ROW_GROUPS = ON)\n\u003e (null)\n\nIt seems to work, but I would like a feedback from you!\n\nThanks in advance!","author":{"url":"https://github.com/VlachosChris","@type":"Person","name":"VlachosChris"},"datePublished":"2026-01-16T13:04:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/3/SynapseTools/issues/3"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:628b9330-5f8c-57fa-6492-61625df500bf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E3E4:13CB91:33FA3B:461313:6A627328 |
| html-safe-nonce | f3ced74261d694eeda27a9be8536434daa2e1ceaa683a510f82c7728b91d27fa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0U0OjEzQ0I5MTozM0ZBM0I6NDYxMzEzOjZBNjI3MzI4IiwidmlzaXRvcl9pZCI6IjQzMjU1MDQ5OTIwMDA3NjY3NjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | aadd0fccf8aff547e9fc74aab71c4d9d5a1c55366547740c50eda7a680eb63c5 |
| hovercard-subject-tag | issue:3821955396 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ProdataSQL/SynapseTools/3/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2918021045c97ae6e5f0222b6f8a11ab29d71bedc262ee1ce7f686542c471d4d/ProdataSQL/SynapseTools/issues/3 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2918021045c97ae6e5f0222b6f8a11ab29d71bedc262ee1ce7f686542c471d4d/ProdataSQL/SynapseTools/issues/3 |
| og:image:alt | Hello! I faced an issue while I was trying to exclude a table from an entire schema on the ColumnstoreOptimize procedure (just like on StatsOptimize). Example: Command EXEC [dba].[ColumnstoreOptimi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | VlachosChris |
| hostname | github.com |
| expected-hostname | github.com |
| None | 838e87bd0e4f5415707a930bc14e89e382dc2ea046e50ff575252eb2f2cb06a2 |
| turbo-cache-control | no-preview |
| go-import | github.com/ProdataSQL/SynapseTools git https://github.com/ProdataSQL/SynapseTools.git |
| octolytics-dimension-user_id | 24268746 |
| octolytics-dimension-user_login | ProdataSQL |
| octolytics-dimension-repository_id | 363639398 |
| octolytics-dimension-repository_nwo | ProdataSQL/SynapseTools |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 363639398 |
| octolytics-dimension-repository_network_root_nwo | ProdataSQL/SynapseTools |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f0081192f88523d2bf4cfdf22bb3e138affc4cd1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width