WAF-PERF-120 β Database workloads MUST undergo regular index and query performance reviews
Description
All production databases MUST enable query performance insights, slow-query logging, or execution plan analysis. Slow queries exceeding defined latency thresholds MUST be reviewed monthly and optimized. Indexes MUST be justified by query patterns and revisited as access patterns evolve. Query review results MUST be documented in a performance register.
Rationale
| Risk | Description |
|---|---|
Risk |
Unreviewed slow queries accumulate until they become critical latency or availability incidents. |
Risk |
Missing indexes force full table scans, increasing cost and degrading user experience. |
Requirements
-
All production databases MUST enable query performance insights, slow-query logging, or execution plan analysis.
-
Slow queries exceeding defined latency thresholds MUST be reviewed monthly and optimized.
-
Indexes MUST be justified by query patterns and revisited as access patterns evolve.
-
Query review results MUST be documented in a performance register.
Implementation Guidance
-
Document the requirement in a version-controlled policy, ADR, or standard.
-
Assign ownership and establish a review cadence (e.g., quarterly).
-
Implement the required configuration as code in Terraform or equivalent IaC.
Maturity Levels
| Level | Name | Criteria |
|---|---|---|
L1 |
Ad hoc β control not consistently applied |
* Die Anforderung ist nicht einheitlich umgesetzt; Nachweis existiert nur punktuell oder fehlt. |
L2 |
Standardised β policy defined and communicated |
* Eine dokumentierte Policy oder ein Standard beschreibt die Anforderung. |
L3 |
Integrated β automated validation in CI/CD |
* Terraform-Checks oder IaC-Gates prΓΌfen die Anforderung automatisch in CI/CD. |
L4 |
Auditable β metrics and exceptions tracked |
* Abdeckung, Ausnahmen und QualitΓ€tsmetriken werden quartalsweise berichtet. |
L5 |
Optimised β continuous improvement based on data |
* Die EffektivitΓ€t wird kontinuierlich gemessen und automatisch optimiert. |
Checks
waf-perf-120.tf.aws.rds-performance-insights
Engine: terraform | Provider: aws | Automated: Yes
AWS RDS instances must enable Performance Insights
AWS RDS instances must enable Performance Insights
Scope: resource β aws_db_instance, aws_rds_cluster_instance
Assertions:
* performance_insights_enabled is_true β RDS must have Performance Insights enabled for query review.
Remediation: AWS RDS instances must enable Performance Insights
# Example compliant with waf-perf-120.tf.aws.rds-performance-insights
# Example non-compliant with waf-perf-120.tf.aws.rds-performance-insights
waf-perf-120.config.query-review-register
Engine: config | Provider: any | Automated: No
Database query review register must exist
Database query review register must exist
Scope: file β docs/performance/db-query-review.md
Assertions:
* exists attribute_exists β Database query review register must document review cadence and owners.
Remediation: Database query review register must exist
# Example compliant with waf-perf-120.config.query-review-register
# Example non-compliant with waf-perf-120.config.query-review-register
Evidence
-
Terraform configuration implementing the requirement.
-
Policy, ADR, or standard documenting the requirement.
-
Optional cloud console or API output confirming runtime state.
Related Controls
-
WAF-REL-110 == Regulatory Mapping
-
AWS Well-Architected Framework: PERF 04 β Optimize data patterns
-
Azure Well-Architected Framework: Performance Efficiency β Data storage