liveBook · Manning

Database service

As explained in 100 SQL Server Mistakes and How to Avoid Them

A cloud service model in which a provider manages database infrastructure and database software for customers.

A database service, or Database as a Service (DBaaS), lets a cloud provider manage the underlying server and database software while customers manage the databases hosted there. section 1.2.2

Mistake #38: installing a SQL Server virtual machine when a managed database service will suffice. The choice can increase operational work and cost, especially for a greenfield cloud application with uncertain capacity and a stretched DBA team. section 8.6 section 1.3

Choose the service boundary deliberately:

  • AWS RDS and Azure SQL Database provide DBaaS, leaving the provider responsible for lower infrastructure layers. section 1.2.2
  • Azure SQL Managed Instance provides a middle ground: customers manage the SQL Server instance while Azure manages the operating system and virtual machine. section 1.2.2
  • Do not assume DBaaS removes SQL Server expertise; database design, development, and code optimization still affect performance. section 1.3
  • Compare the premium for hosting, patching, securing, and optimizing the lower stack against the cost of operating infrastructure yourself. section 1.3

MagicChoc’s cloud application

MagicChoc planned an Azure application using Event Grid, Functions, and Kubernetes Service, with uncertain database capacity. Recommending an Azure SQL virtual machine instead of Azure SQL Database ignored the advantages of a cloud-native managed service. section 8.6

Listing 8.5 Creating an autoscaling Azure SQL Database
$sqlAdminName = 'MagicChocAdmin'
$sqlAdminPassword = 'Passw0rd!'

$credentials = $(New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $sqlAdminName, 
$(ConvertTo-SecureString -String $sqlAdminPassword -AsPlainText -Force))

$serverParameters = @{
   ServerName = 'processautomationsql'
   Location = 'eastus2'
   SqlAdministratorCredentials = $credentials
   ResourceGroupName = 'MagicChocApps'
}


New-AzSqlServer @serverParameters


$databaseParameters = @{
   ResourceGroupName = 'MagicChocApps'
   ServerName = 'processautomationsql'
   DatabaseName = 'AutoPro'
   Edition = 'GeneralPurpose'
   ComputeModel = 'Serverless'
   ComputeGeneration = 'Gen5'
   MinimumCapacity = 2
   Vcore = 16
}

New-AzSqlDatabase @databaseParameters

Use the PowerShell listing to create a serverless, autoscaling Azure SQL Database with General Purpose, Gen5, minimum-capacity, and vCore settings. section 8.6

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Distinguishes DBaaS from virtual machines and managed instances, but does not descend into database-engine internals.
Examples
Uses AWS RDS, Azure SQL Database, Azure SQL Managed Instance, and MagicChoc’s Azure process-automation application.
What it assumes
Assumes SQL Server awareness while reinforcing that database development and optimization remain necessary under DBaaS.
What you can do after
Operate/configure an Azure SQL Database with PowerShell and evaluate DBaaS against virtual-machine deployment.
How it connects
Connects DBaaS with IaaS, PaaS, managed instances, SQL Server, relational databases, NoSQL, and cloud cost management.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.