Question

We have an Azure SQL Database tier S4 (200 DTU), and there is one big table inside
When I run a "alter index rebuild..." statement, it takes about 18 mins to complete

This particular nonclustered index is 5 Gb in size, and during those 18 minutes of rebuilding, it takes all 100% of DTU available to this database Of course, this is impacting other applications that are trying to work with this database

Question:

How can we limit available resources for a given session that runs a rebuild ?
Say, we want to make it use only 50%-60% of Database's DTUs, but not 100%

Is this possible on Azure SQL Database ?

Regards,

Was it helpful?

Solution

You just thought of a great enhancement request. Sort of an OPTION(MAXDTU 5000) sort of deal.

Not there now. Best bet would either be to scale up for the operation you need programmatically or try and limit the MAXDOP for that operation either an OPTION (MAXDOP 1) hint. The index operation will run longer in serial but likely consume less DTUs.

OTHER TIPS

Have you considered using the Resumable Online Index Rebuild feature so you can schedule X executions of one minute of those indexes?

ALTER INDEX [ix_CustomerIDs]
ON [ContosoSales].[ConstosoTransactionData]
REBUILD
WITH (ONLINE = ON, RESUMABLE = ON, MAX_DURATION = 1 MINUTES);
GO

ALTER INDEX ix_CustomerIDs ON [ContosoSales].[ConstosoTransactionData] PAUSE

ALTER INDEX ix_CustomerIDs ON [ContosoSales].[ConstosoTransactionData] RESUME

Have you considered to scale up the tier to Premium to speed up things when performing index maintenance during any small maintenance window? You will pay Premium for just the hour where you scaled up and users may perceive less performance impact.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top