Set-DbaDbCompression always compresses all materialized Views in DB
Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
When using set-dbadbcompression and specifying one or more tables:
The tables and indexes are compressed as expected. After that the script iterates through all Views in the the database compresses them as well.
See set-dbadbcompression.ps1 line 286:
foreach ($index in $($server.Databases[$($db.name)].Views | Where-Object { $_.Indexes }).Indexes)
Thank you for your help -tom
Steps to Reproduce
Set-DbaDbCompression -SqlInstance 'server100' -Database 'DB000' -Table 'Fancytable1' -CompressionType Page
Please confirm that you are running the most recent version of dbatools
tested with 1.1.132
Other details or mentions
No response
What PowerShell host was used when producing this error
Windows PowerShell (powershell.exe)
PowerShell Host Version
This happens in Windows Powershell and pwsh as well.
SQL Server Edition and Build number
SQL Server 2019 Enterprise Edition
.NET Framework Version
.NET Framework 4.7.3946.0
Thanks for the report, tom! @jpomfret any chance you can take a look?
Oh good thought, I'll take a look into that for you. Thanks for the report.
(Probably not for a week though as I just went on holiday - will set a reminder for when I'm back!)
Enjoy 🌴 🏖️ !
This got a bit stale. So let me bring this issue to you attention again...
I see two options here:
- We can take the parameters and the documentation as set and just remove the code in lines 285 to 325.
- We add a new parameter
-Viewand filter the views to process based on that parameter.
I can help coding if needed.