SQL
AuraScore 81/100

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.

Template

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

  1. Analyze query execution plans across {{identified_bottleneck_tables}} to locate expensive table scans, nested loops, and spilling operations.
  2. Diagnose anti-patterns in {{aml_batch_pipeline}} such as non-sargable predicate filters, implicit type conversions, and unbounded window aggregates.
  3. Formulate temporary staging table strategies to replace multiple correlated subqueries across historical transaction tables.
  4. Design targeted composite indexes with included columns aligned to {{underlying_database_engine}} optimizer mechanics.
  5. Project precise execution time reductions based on the transition from {{current_execution_time}} toward {{target_sla_limit}}.
  6. Detail zero-downtime deployment steps ensuring transactional consistency during migration at {{financial_institution}}.
  7. 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:

  1. Executive Summary & Impact (current vs target SLA analysis)
  2. Root Cause Query Diagnostics (specific scan/join anti-patterns)
  3. Proposed Refactoring & Indexing Plan (including pseudo-SQL demonstration)
  4. 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}}.
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

data-analytics
data-sql
financial-services
sql
aml
database-tuning