sql server – How should I handle index maintenance on partitioned tables in Azure SQL DB?

let’s start saying that i have no experience with partitioned tables and i’m not quite sure how to handle index maintenance (Rebuild / Reorganize). Consider my scenario:

we have 3 tables partitioned by year-month on the same PRIMARY filegroup, as Azure forces you to do, containing historical data with a retention of 2 years. Two of these tables have one aligned clustered index each, the remaining one has one aligned NON clustered index. Since we don’t need to archieve our data, once per month every partition that contains data older than X gets truncated and merged.

i’ve found very little evidence around the Web about this topic, and i couldn’t get a satisfying post / thread that fully explains what is needed to do. I heard that, thanks to the truncation of the entire partition, there is no need to periodically maintain the aligned indexes, is that true?

(As posted here: stackoverflow.com/questions/72079756/best-practice-for-rebuilding-sql-server-indexes-on-partitioned-table-after-purg)

Thank you.

Read more here: Source link