Azure SQL Serverless Database

You might have a question, i.e., how to stop SQL Azure DB when not in use. It is needed because there is no point in paying for the Azure SQL Database when you are not using it. Now, Azure SQL Database Serverless is the answer to the question of how to stop SQL Azure DB when not in use.

Azure SQL Database Serverless Database

Serverless is essentially a compute tier designed for single databases, allowing you to bill only for the compute used per second. It scales resources based on demand and, most importantly, pauses the database when it’s inactive. You will only be billed for the storage, not the compute, during that time.

The database resumes automatically with the next login or if anyone performs any activity in the database.

Understanding Azure SQL Serverless Architecture

Azure SQL Serverless represents a shift in database models. Unlike traditional provisioned databases, where you pay for constant compute capacity, serverless automatically scales compute resources based on workload demand and bills you only for what you use.

Core Components of Azure SQL Serverless

The serverless architecture consists of several key components that work together to deliver automatic scaling and cost optimization:

  • Auto-scaling Compute: Dynamically adjusts vCores based on workload demands
  • Auto-pause Functionality: Automatically pauses databases during inactive periods
  • Storage Separation: Decouples storage from compute for independent scaling
  • Instant Resume: Quickly resumes paused databases when activity is detected

Key Features Of Serverless Tier

There are a few key features available in the serverless tier. Those are as follows.

Autoscaling Capability

It automatically scales the compute resources based on the workload or demand, which improves the performance.

Best Memory Management

In the case of a serverless database, the memory recovers frequently, which helps to control the cost. Manages memory effectively through cache reclamation and Cache hydration.

Auto-pausing

Auto-pausing is another essential feature of a serverless database. Suppose the system finds the number of sessions to be zero and the CPU usage to be 0 for the user workload running in the user pool. This mainly helps you to control the cost.

Auto-resuming

It resumes the database automatically in a few scenarios, like on the next login, to modify the threat detection settings, to view the auditing records, To add, edit, view sensitivity levels, To add, edit, delete, view data masking rules, To view, modify query store settings, To view or apply performance recommendations, In case of auto-indexing, To export a database, To add the new database tags, etc.

When to Use Azure SQL Serverless

  • Development and Testing Environments
  • Intermittent Workloads
  • Small to Medium Applications
  • Single databases that are not continuous or steady
  • Single database without usage history
  • Single databases that are inactive for a long time, etc.

Scenarios to Avoid

ScenarioReason to AvoidRecommended Alternative
High-frequency OLTPFrequent pause/resume cyclesProvisioned compute
Predictable 24/7 workloadsNo cost benefit from auto-pauseGeneral Purpose tier
Memory-intensive applicationsLimited memory scaling optionsBusiness Critical tier
Applications requiring <1 second responseResume latency considerationsAlways-on provisioned

Setting Up Azure SQL Serverless

Method 1: Azure Portal Configuration

Here’s the complete setup process:

-- Step 1: Create serverless database via T-SQL
CREATE DATABASE [CustomerAnalytics_Dev]
(
    EDITION = 'GeneralPurpose',
    SERVICE_OBJECTIVE = 'GP_S_Gen5_1',
    MAX_SIZE = 100 GB,
    COMPUTE_MODEL = 'Serverless'
);

Portal Configuration Steps:

  1. Navigate to Azure SQL Database creation
  2. Select “Configure database” under Compute + Storage
  3. Choose “Serverless” compute tier
  4. Configure auto-pause settings (1 hour to 7 days)
  5. Set minimum and maximum vCore limits

Check out the screenshots below for your reference.

azure sql serverless database
azure sql serverless

Cost Calculation for a Serverless Database

  1. The first and essential point to note is that when the database is paused, you need