Skip to content

Databases and Storage for AI Applications

Give an AI application a real storage design. You turn Larkfield's ticket API into a service that owns its data in PostgreSQL, keeps files in object storage and vectors next to the records, stays fast on large data, and can be restored after a mistake.

Read every lesson as a guest, or sign in to enroll and track your progress.

What you'll learn

By the end of this course, you will be able to:

  • Choose storage based on access patterns.
  • Design a relational schema with integrity constraints.
  • Diagnose slow queries and manage connections.
  • Store files and vectors with clear ownership and lifecycle rules.

About this course

An AI application stores more than one kind of data. Larkfield, the made-up online shop for home and garden products from the SQL course, has a help desk. It keeps customers and tickets, the photos and receipts that customers attach, the documents its assistants read, a record of every model run with its cost, and vectors for finding similar tickets. Each kind has a different shape, size and lifetime, and each one can be lost or corrupted in its own way.

In this course, you give Larkfield’s ticket API a real storage design, one change at a time. You decide what goes where. You design tables whose rules reject bad data. You call the database from the API through a connection pool, with safe queries and short transactions. You make a slow list endpoint fast and prove it with measurements on large data.

Then you add files and vectors with clear owners. Files go to object storage, and the database keeps their details. Vectors live next to the records they describe, with a version. Finally, you restore a backup to prove that it works, and you delete a customer’s data from every store.

Everything runs on your computer: PostgreSQL with pgvector (an extension that stores vectors), an object-storage emulator and a made-up dataset that is large enough to be slow. Every query plan and timing in the lessons comes from a real run.

Before you start

You completed SQL and Data Preparation for AI and Build and Deploy Your First API, or you have the same skills. The Docker and CI/CD courses are useful but not required. You do not need an account or money. PostgreSQL, the object storage and the embeddings all run on your computer, with Docker or without it.

Courses to take first: SQL and Data Preparation for AI, Build and Deploy Your First API.

Who this is for

People who can write SQL and build a small API, as in SQL and Data Preparation for AI and Build and Deploy Your First API, and now need to store an AI application's data safely. Developers, data scientists and data engineers moving into AI engineering.

How we made this course

Experienced AI practitioners designed this course. AI helped us draft the content; people chose the teaching approach and the examples, and reviewed every lesson. The outputs that you see are the actual results of running the code. How we make our courses

Inside the course

Module 2Design a relational schema

3 lessons

Design a schema that protects itself. Model customers, tickets, files, documents and AI runs, let constraints reject duplicates and orphans, and use transactions so that a change happens completely or not at all.

  1. Entities and relationships50 min
  2. Integrity constraints55 min
  3. Transactions50 min

Module 3Access data from an API

3 lessons

Call the database safely from the API. Use parameters instead of string building, share connections through a pool, keep transactions short, and change the schema with migrations tested on large data.

  1. Safe queries50 min
  2. Connection management55 min
  3. Migrations50 min

Module 4Improve query performance

3 lessons

Make a slow endpoint fast, with proof. Read query plans, add the one index a query needs and measure what it costs, and return pages instead of whole tables.

  1. Read a query plan50 min
  2. Index deliberately55 min
  3. Bound result sizes55 min

Module 5Files, vectors and lifecycle

3 lessons

Store files and vectors with clear owners. Upload and download files with signed links, search similar tickets with pgvector, and practise a restore and a deletion that reaches the database, the files and the vectors.

  1. Object-storage patterns55 min
  2. Vector storage55 min
  3. Recovery and retention60 min

After the case studiesFinal assignment

Use every module in one practice project. You collect evidence, and check it against the course outcomes.

  1. Final assignment180 min

Case studies

Realistic projects from start to finish, on real data, with every output explained. Each one makes a portfolio piece. Complete at least one for the certificate; the others are optional.

  1. Design and tune storage for an open public dataset4 hr

    Load a large open public dataset into PostgreSQL with a schema and constraints, list its access patterns, and measure index and pagination improvements on its real queries.

  2. Vector search over an open document collection4 hr

    Store embeddings of an open document collection in pgvector, compare exact and approximate search on recall and time, filter by metadata, change the embedding version and delete a document everywhere.

Reviews

Loading the reviews…

    Took this course? Sign in to review it. Learners can write a review after they complete 25% of the lessons.

    Share this course