-- 52_explain_analyze_examples.sql
-- Banking Pattern Pack — PostgreSQL
-- Purpose: EXPLAIN (ANALYZE) on joins/filters.
-- 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;

-- EXPLAIN ANALYZE example
EXPLAIN (ANALYZE, BUFFERS)
SELECT * FROM bank.transactions t
JOIN bank.accounts a ON a.account_id = t.account_id
WHERE t.created_at > now() - INTERVAL '30 days';
