BackendQuestion 11 of 52
Safe Online Schema Migrations
Problem
Adding a column with a default value to a large table in production can cause an exclusive lock, locking out web requests. Write a query that outputs a best practice as best_practice with the value: "To safely add a default value to a large table, add the column without a default first, then apply the default for new rows, and backfill existing rows in batches."
Database Schema
This problem acts as a scratchpad. You will write your own DDL/DML or conceptual queries, so there is no predefined schema.
Try It
Loading playground environment...