Approach: follow a hypothesis-driven checklist (quick checks → deeper root-cause) and provide diagnostic SQL to isolate where rows disappear. Communicate status frequently (initial ack, interim findings, final resolution + action items).Checks & order1) Confirm environment & timeframe: correct DB/schema, prod vs dev, date filters.2) Row counts and basic stats: table-level counts, recent ingestion.3) Schema/column changes: added/renamed columns, data types.4) Join/filter logic: identify which join/filter removes rows.5) Data freshness & jobs: ETL/CDC failures, partitioning.6) Permissions/views: view definitions, access changes.7) Recent deploys/commits: PRs that changed logic.Diagnostic SQL snippetsQuick totals and date ranges:sql
SELECT COUNT(*) AS total_rows,
MIN(created_at) AS min_dt,
MAX(created_at) AS max_dt
FROM product_events
WHERE product_id = 123;
Check report input tables individually:sql
SELECT 'table_a' AS t, COUNT(*) FROM table_a WHERE product_id=123
UNION ALL
SELECT 'table_b', COUNT(*) FROM table_b WHERE product_id=123;
Find which join filters rows (convert INNER -> LEFT to expose missing keys):sql
SELECT a.id AS a_id, b.id AS b_id
FROM table_a a
LEFT JOIN table_b b ON a.key = b.key
WHERE a.product_id = 123
AND b.id IS NULL
LIMIT 50;
Check filter predicates (dates, status):sql
SELECT status, COUNT(*) FROM table_a
WHERE product_id=123
GROUP BY status;
Compare current view vs underlying tables:sql
-- view definition
SELECT view_definition FROM information_schema.views WHERE table_name='product_report_view';
Check recent loads/partitions:sql
SELECT partition, MAX(load_time) FROM etl_log WHERE table_name='table_a' GROUP BY partition;
Deeper: inspect NULLs/types, recent schema changes via audit tables or git.Communication plan- Initial message (5–15 min): acknowledge, confirm scope (product id, expected timeframe), ETA for first update.- Interim updates (30–60 min): share quick findings (e.g., "source table has rows; join to table_b drops them; 200 missing keys — see sample"), attach diagnostic query results and proposed next step.- Final update: root cause, resolution steps taken, impact assessment (how long report was wrong), and mitigation (alerting, tests, rollback, schema-change process). If not resolved, provide next actions and owners.Why this works: small targeted queries isolate where data vanishes (source vs transformation vs reporting), LEFT JOINs reveal missing keys, and regular stakeholder updates manage expectations and enable cross-team fixes.