Core Banking AML SQL Optimization Advisory
Optimize regulatory anti-money laundering SQL batch queries breaching compliance execution windows.
Use this template when critical compliance batch jobs run past their regulatory SLA windows. It delivers a structured engineering advisory email proposing query refactoring, index restructuring, and temp-table optimizations.
Role: Lead Database Reliability Engineer specializing in high-throughput financial compliance systems.
Context
- Target institution: {{financial_institution}}
- Target pipeline: {{aml_batch_pipeline}}
- Current batch runtime: {{current_execution_time}}
- Regulatory SLA threshold: {{target_sla_limit}}
- Database platform: {{underlying_database_engine}}
- Heavy transaction tables: {{identified_bottleneck_tables}}
Task
Draft an authoritative technical advisory email to the Head of Financial Crime Technology proposing immediate query refactoring, index modifications, and partition pruning strategies to eliminate SLA breaches in AML transaction monitoring.
Method
- Analyze query execution plans across {{identified_bottleneck_tables}} to locate expensive table scans, nested loops, and spilling operations.
- Diagnose anti-patterns in {{aml_batch_pipeline}} such as non-sargable predicate filters, implicit type conversions, and unbounded window aggregates.
- Formulate temporary staging table strategies to replace multiple correlated subqueries across historical transaction tables.
- Design targeted composite indexes with included columns aligned to {{underlying_database_engine}} optimizer mechanics.
- Project precise execution time reductions based on the transition from {{current_execution_time}} toward {{target_sla_limit}}.
- Detail zero-downtime deployment steps ensuring transactional consistency during migration at {{financial_institution}}.
- Establish automated performance regression telemetry alerts for production query runs.
Constraints
- MUST write in professional engineering executive email syntax with clear technical precision.
- MUST NOT suggest hardware scaling as the primary remediation over code optimization.
- MUST include before-and-after pseudo-SQL fragments demonstrating the core indexing or sargable filter fix.
- Recommendations MUST comply with standard financial regulatory data retention guidelines.
- Total email length must remain between 400 and 700 words.
Output format
Email format structured into four distinct sections:
- Executive Summary & Impact (current vs target SLA analysis)
- Root Cause Query Diagnostics (specific scan/join anti-patterns)
- Proposed Refactoring & Indexing Plan (including pseudo-SQL demonstration)
- Risk Mitigation & Deployment Checklist (4-6 bulleted action items)
Self-review
- Confirm all 6 context variables are contextually woven into the remediation analysis.
- Verify that before/after SQL patterns accurately resolve the identified bottleneck.
- Ensure technical recommendations are strictly compatible with {{underlying_database_engine}}.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.