Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

When to use a managed database

After this lesson: I can say when to use a managed database.

45 min lessonNo commands

The database under the desk

A small delivery firm keeps its orders database on a server under a desk. One Sunday the disk fails.

The last backup is three weeks old, and nobody knows how to restore it. On Monday the drivers have no list of deliveries. A managed database is one way to stop this happening.

By the end of this lesson

Note

I can say when to use a managed database.

Key words

WordWhat it means
Managed databasea database the provider runs for you
Self-managedyou install and run it yourself
Backupa saved copy you can restore
Patchan update that fixes a fault
Replicaa live copy on another machine
Failoverswitching to the replica when the main one fails

The cells students fill in are left blank in this preview.

The provider does the routine work

A database needs care to keep running. Someone must take backups, install patches and watch the disk fill up.

With a managed database, the provider does that routine work. You choose the size and the region, and you get an address to connect to. The provider takes a backup every night. It keeps a replica ready for failover.

Worked example: who does what

JobSelf-managedManaged
Install the databaseYouProvider
Install patchesYouProvider
Take nightly backupsYouProvider
Switch to a replica if it failsYouProvider
Design the tablesYouYou
Write fast queriesYouYou
Decide who may connectYouYou

The cells students fill in are left blank in this preview.

Your program still speaks the same SQL

From your side, a managed database works like any other. Your program connects to an address with a user name and a password.

Then it sends SQL, the language you use to ask a database for data. So moving to a managed database rarely means rewriting the program. The query below runs the same on a server under a desk or in the cloud.

Try it: the deliveries still to make

Code: sql
-- Deliveries not made yet. This SQL is the same on any database.
SELECT id, driver, town
FROM deliveries
WHERE delivered = 0;

-- Change the query to show only Tom's deliveries, then press Run.

When managed is the right choice

Choose a managed database when your team is small and nobody’s job is looking after databases. Choose it when an hour of downtime would hurt the business.

Look at self-managed when you need software the provider does not offer, or full control of the machine. A very large, steady load can also cost less on your own server. Count the staff hours, not only the price.

Worked example: counting the staff time

ItemManagedSelf-managed
Monthly price£120£60
Staff hours each month16
Staff cost at £30 an hour£30£180
Total each month£150£240

The cells students fill in are left blank in this preview.

A common mistake

Warning

Many people think a managed database keeps their data safe whatever they do. The provider keeps it running and takes backups. It does not check your queries. A DELETE with the wrong WHERE is copied to the replica in a second. Test restoring a backup before you need it.

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.