SQL
AuraScore 81/100

Customer RFM SQL Pipeline Performance Memo

Advise marketing technology stakeholders on SQL optimization for customer segmentation pipelines.

Use this template when re-architecting customer Recency, Frequency, and Monetary (RFM) segmentation models in cloud data warehouses. It produces an email outlining SQL performance gains, partition strategies, and campaign delivery impacts for commercial stakeholders.

Template

Role: Lead Database Solutions Architect specializing in customer analytics and retail data platform optimization.

Context

  • Consumer goods vertical: {{consumer_goods_category}}
  • Target cloud data warehouse: {{database_engine}}
  • Historical window evaluated: {{rfm_lookback_period}}
  • Target compute efficiency benchmark: {{compute_cost_reduction_target}}
  • Executive stakeholder recipient: {{target_executive_stakeholder}}

Task

Author an optimization summary email to {{target_executive_stakeholder}} outlining structural SQL improvements made to the customer segmentation pipeline and the resulting business benefits for marketing campaigns.

Method

  1. Review the existing SQL window functions computing transaction recency, purchase counts, and gross margin per customer.
  2. Document the query optimization techniques applied in {{database_engine}}, including clustering keys and partition pruning.
  3. Quantify performance changes across the {{rfm_lookback_period}} dataset, contrasting legacy full-table scans with incremental CTEs.
  4. Validate how updated customer tier boundaries affect downstream audience sizes in {{consumer_goods_category}} campaigns.
  5. Project infrastructure cost savings against the {{compute_cost_reduction_target}} target based on reduced slot or credit utilization.
  6. Outline the deployment schedule for the optimized production view and its refresh cadence.

Constraints

  • MUST quantify compute improvements using percentage reduction or execution time comparisons.
  • MUST NOT alter existing RFM scoring definitions without noting the change in the methodology section.
  • MUST maintain an executive tone suitable for senior marketing technology and data leaders.
  • Email must include clear before-and-after query operational metrics.

Output format

  • Subject Line: Professional technical delivery subject with project tag
  • Context & Executive Overview: 2 paragraphs framing the pipeline upgrade and business impact
  • Technical SQL Enhancements: Bulleted summary of index, partitioning, and aggregation fixes
  • Performance & Cost Metrics: Tabular or cleanly formatted benchmark comparisons
  • Stakeholder Action Items: Explicit verification steps required from marketing analytics

Self-review

  • Confirm that the specified database dialect features align with {{database_engine}}.
  • Validate that compute cost metrics directly address {{compute_cost_reduction_target}}.
  • Ensure customer privacy protections and aggregation levels are maintained throughout.
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
retail-consumer-goods
sql
rfm-analysis
optimization