A practical case study: analyze plan, identify sequential scans and sort cost, add the right composite index, and validate with EXPLAIN ANALYZE.
CREATE INDEX idx_dms_variable_dmsid_code_value ON dms_variable (dms_id, dms_master_codify_code, value);