-- 36_multicolumn_index_hot_path.sql
-- Banking Pattern Pack — PostgreSQL
-- Purpose: Multi‑column index for account_id + created_at.
-- Context: Retail bank example with customers, accounts, transactions, cards, loans.
-- Date: 2025-08-18
-- Notes:
--   * Safe to read; run on a development DB.
--   * Requires: CREATE privileges; some files may need superuser for extensions.
--   * Search path set to 'bank' schema for clarity.
SET search_path = bank, public;

-- Multi‑column index for hot path: (account_id, created_at)
CREATE INDEX IF NOT EXISTS tx_account_created_idx ON bank.transactions (account_id, created_at DESC);
