Engineering/Database
Database Indexes and SQL Execution Plans
Suppose we have the following orders table:CREATE TABLE orders ( order_id BIGINT PRIMARY KEY, customer_id BIGINT NOT NULL, order_status VARCHAR(20) NOT NULL, ordered_at DATETIME NOT NULL, total_amount BIGINT NOT NULL);When the table contains only a few hundred rows, the following query returns almost immediately:SELECT *FROM ordersWHERE customer_id = 1001;The situation changes whe..