Inferensys

Prompt

Database Saturation Test Scenario Prompt

A practical prompt playbook for generating database saturation test scenarios that identify data layer breaking points, including read/write mix ratios, query patterns, connection pool sizing, and saturation indicators.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, the ideal user profile, required context, and explicit boundaries for the Database Saturation Test Scenario Prompt.

Use this prompt when you need to design a precise, multi-axis database saturation test before running load generation tools like pgbench, sysbench, or k6. The job-to-be-done is translating your specific database architecture, schema characteristics, traffic patterns, and infrastructure constraints into a structured, executable test scenario. This is not a generic load test prompt; it is for database reliability engineers, performance engineers, and platform teams who need to find the real saturation ceiling of their data layer by exercising CPU, I/O, locks, and replication lag simultaneously. You should use this prompt when you already have monitoring in place for these key metrics and need a scenario that produces a definitive saturation point, not just a simple throughput number.

The ideal user has a deep understanding of their database's internal topology and can provide detailed context. Required inputs include the database engine and version, a representative schema with data types and index definitions, expected read/write ratios for critical transactions, and infrastructure constraints like CPU cores, memory, and disk type. The prompt works best when you can describe specific query patterns (e.g., 'an UPDATE to a single row by primary key that also touches three non-covering indexes') rather than vague categories. Do not use this prompt if you lack monitoring for lock contention or replication lag, as the output scenario will reference these metrics as primary saturation indicators and you will be unable to validate the results.

This prompt is not a substitute for a full performance test plan and should not be used for simple smoke tests or basic throughput benchmarking. It is explicitly designed for saturation point discovery, meaning the scenario it produces is intended to push the database to its breaking point in a controlled manner. Avoid using this prompt if your goal is to validate normal operating capacity with a comfortable headroom; for that, use a capacity planning load model prompt instead. The output will include aggressive connection pool targets and query patterns designed to create contention, which can be disruptive to shared environments. Always execute the resulting scenario in an isolated performance environment that mirrors production hardware, never against a live production database.

Before using this prompt, ensure you have gathered your database's key metrics baselines under idle and normal load. The prompt will ask you to specify saturation indicators for CPU, I/O, locks, and replication lag, and you will need to know your alerting thresholds for each. A common failure mode is providing unrealistic or missing constraints, which leads to a scenario that saturates a resource you cannot monitor or hits a cloud provider's hard limit that you forgot to mention. After generating the scenario, your next step is to review the query templates for index utilization assumptions and validate that the proposed connection pool sizing does not exceed your driver or proxy limits. Then, wire the scenario into your load tool of choice and execute it with your monitoring dashboards ready.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt delivers value and where you should reach for a different approach.

01

Good Fit: Pre-Production Saturation Testing

Use when: you have a known database topology, schema, and representative query patterns and need a structured test scenario before load testing begins. Guardrail: always pair the generated scenario with actual connection pool and driver configuration from the target environment.

02

Bad Fit: Real-Time Incident Response

Avoid when: the database is currently in a degraded state and you need immediate diagnostic steps. This prompt designs planned experiments, not live triage. Guardrail: route production incidents to runbook and diagnostic prompts instead.

03

Required Input: Query Patterns and Data Shape

What to watch: the prompt needs representative read/write ratios, index definitions, and approximate row counts to produce a useful scenario. Guardrail: provide EXPLAIN plans or query logs as [CONTEXT]; generic inputs produce generic scenarios that miss real saturation points.

04

Operational Risk: Missing Vacuum/Compaction Impact

What to watch: generated scenarios can overlook storage engine maintenance operations that amplify saturation under load. Guardrail: explicitly include autovacuum, compaction, or WAL checkpoint behavior in [CONSTRAINTS] when targeting PostgreSQL, MySQL, or MongoDB.

05

Operational Risk: Unrealistic Connection Pool Behavior

What to watch: the prompt may assume unlimited connections or ignore pool exhaustion as a saturation signal. Guardrail: specify max connections, pool timeout, and queue depth in [CONSTRAINTS] so the scenario tests connection saturation alongside query saturation.

06

Variant: Replication Lag Focus

What to watch: standard saturation scenarios often miss replication lag as a bottleneck. Guardrail: when testing read replicas or geo-distributed setups, add replication lag thresholds and read-your-writes consistency checks to [OUTPUT_SCHEMA] requirements.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A ready-to-use prompt template for generating a database saturation test scenario with explicit placeholders for your system's architecture, SLAs, and monitoring stack.

This prompt template is designed to produce a structured, executable test scenario for identifying the saturation point of a database system. It forces the model to consider the full stack—from connection pooling and query patterns to OS-level I/O and replication lag—by requiring you to fill in specific architectural details. The output is a JSON document that can be directly consumed by a test harness, making it suitable for automated CI/CD pipelines or manual performance engineering workflows.

text
You are a senior database performance engineer. Your task is to design a precise, repeatable database saturation test scenario.

Use the following inputs to construct the scenario:
- SYSTEM_ARCHITECTURE: [SYSTEM_ARCHITECTURE_DESCRIPTION]
- DATABASE_TECHNOLOGY: [DATABASE_TYPE_AND_VERSION]
- SLA_TARGETS: [LATENCY_AND_THROUGHPUT_SLAS]
- INFRASTRUCTURE_SPECS: [CPU_MEMORY_IO_AND_NETWORK_SPECS]
- KNOWN_BOTTLENECKS: [EXISTING_PERFORMANCE_CONCERNS]
- MONITORING_TOOLS: [AVAILABLE_METRICS_AND_LOG_SOURCES]

Generate a test scenario that strictly adheres to this JSON schema:
{
  "scenario_name": "string",
  "objective": "string (a single, measurable saturation goal)",
  "workload_model": {
    "read_write_mix_ratio": "string (e.g., '80:20')",
    "query_patterns": [
      {
        "query_template": "string (parameterized SQL/query)",
        "calls_per_second_target": "number",
        "average_result_set_size": "string (e.g., '100 rows')"
      }
    ],
    "connection_pool_config": {
      "min_connections": "number",
      "max_connections": "number",
      "ramp_up_period_seconds": "number"
    }
  },
  "saturation_indicators": {
    "primary_metric": "string (e.g., 'CPU utilization > 85%')",
    "secondary_metrics": ["string (e.g., 'write IOPS at provisioned limit')"],
    "replication_lag_threshold_ms": "number",
    "lock_contention_threshold": "string (e.g., 'lock wait time > 100ms')"
  },
  "test_phases": [
    {
      "phase_name": "string",
      "duration_minutes": "number",
      "target_concurrent_users": "number",
      "description": "string"
    }
  ],
  "assumptions_and_risks": {
    "index_utilization_assumptions": ["string"],
    "vacuum_compaction_impact_notes": "string",
    "data_volume_estimate": "string (e.g., '500GB')",
    "missing_observability_risks": ["string"]
  },
  "success_criteria": {
    "saturation_point_identified": "boolean",
    "degradation_is_graceful": "boolean",
    "no_data_corruption": "boolean"
  }
}

CONSTRAINTS:
- The read/write mix must be justified by the SLA_TARGETS.
- Every query pattern must be traceable to a specific user journey or backend process.
- Saturation indicators must be directly observable with the provided MONITORING_TOOLS.
- Explicitly state what you assume about index usage and the impact of missing or stale database statistics (e.g., vacuum/compaction).
- If the KNOWN_BOTTLENECKS input is empty, state that the scenario is a broad search for the first bottleneck.

OUTPUT: Only the valid JSON object. No other text.

To adapt this template, replace every [PLACEHOLDER] with concrete values from your system's runbook and architecture diagrams. The SYSTEM_ARCHITECTURE_DESCRIPTION should be a dense summary of how your application connects to the database, including any caching layers. The MONITORING_TOOLS field is critical; the model's ability to define useful saturation_indicators depends entirely on the granularity of the metrics you list. After generating the scenario, validate the JSON against the provided schema before passing it to your load testing tool (e.g., k6, Locust, or a custom harness). For high-risk production databases, always have a senior engineer review the assumptions_and_risks section to ensure the test won't cause an unexpected outage.

IMPLEMENTATION TABLE

Prompt Variables

Every placeholder the prompt expects, why it matters, and how to validate it before use. Wire these into your test harness or orchestration layer before sending the prompt to the model.

PlaceholderPurposeExampleValidation Notes

[DATABASE_TYPE]

Specifies the target database engine to tailor saturation indicators and query patterns

PostgreSQL 15

Must match a supported engine in your test harness. Validate against an allowlist: PostgreSQL, MySQL, MongoDB, CockroachDB, etc. Reject if empty or unrecognized.

[SCHEMA_SUMMARY]

Describes the relevant tables, indexes, and data types so the model can propose realistic query patterns

users (id UUID PK, email TEXT, created_at TIMESTAMPTZ); orders (id UUID PK, user_id FK, total NUMERIC, status TEXT)

Parse as structured text. Validate that at least one table with columns is present. Reject if only table names without column definitions are provided.

[DATA_VOLUME_ESTIMATE]

Provides current or projected row counts and growth rate to anchor saturation predictions

users: 50M rows, orders: 200M rows, growing 15% monthly

Parse numeric values and units. Validate that at least one row count is present and non-zero. Warn if growth rate is missing but allow null for static datasets.

[HARDWARE_PROFILE]

Defines the compute, memory, and storage resources available so saturation thresholds are realistic

db.r6g.4xlarge: 16 vCPU, 128 GB RAM, 500 GB gp3 storage, 16,000 IOPS

Validate that CPU count, memory, and storage are present. Parse numeric values. Reject if memory is less than 1 GB or CPU count is zero. Warn if IOPS or disk type is missing.

[READ_WRITE_RATIO]

Sets the expected proportion of read vs write operations to shape the workload mix

80:20 read-heavy OLTP

Parse as ratio or percentage. Validate that values sum to approximately 100. Reject if ratio is 0:0 or 100:0 without explicit justification. Allow string descriptions like read-heavy or write-heavy as fallback.

[CONNECTION_POOL_CONFIG]

Describes current pool sizing and timeout settings to identify saturation risks at the connection layer

max_connections=500, pool_size=50, idle_timeout=10min, max_lifetime=1h

Validate that max_connections or pool_size is present. Parse numeric values. Reject if pool_size exceeds max_connections. Warn if timeout values are missing.

[REPLICATION_TOPOLOGY]

Defines replication architecture so the model can assess lag and consistency saturation points

primary with 2 read replicas, async replication, 50ms average lag

Validate that at least one primary and replica count is present. Parse lag value if provided. Reject if replica count is negative. Allow null for single-node deployments.

[EXISTING_MONITORING_SIGNALS]

Lists the metrics and thresholds already in place so the scenario builds on known baselines

CPU > 70% alert, replication lag > 5s alert, connection count > 400 warning

Parse as list of metric-threshold pairs. Validate that at least one signal is present. Warn if thresholds appear unrealistic (e.g., CPU > 0%). Allow null if no monitoring exists yet.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the database saturation scenario prompt into a pre-test workflow with validation, human review, and result comparison.

This prompt produces a scenario document, not executable code. You will need to translate the output into your load testing tool of choice. Wire the prompt into a pre-test workflow that runs before each saturation test cycle. Feed the output into a human review step where a database engineer confirms the query mix, connection targets, and saturation indicators match the current system state.

After review, parameterize your load generator with the read/write ratios, query templates, and ramp schedule from the scenario. During test execution, collect the saturation indicators the prompt specified and compare against the predicted saturation sequence. Log any deviation between predicted and actual saturation order for post-test analysis. If the model proposes a saturation indicator you cannot measure, flag it before test execution and either add the metric or remove the indicator from the scenario.

Store each generated scenario alongside test results for auditability and regression comparison. When the database schema, indexing strategy, or hardware profile changes, re-run the prompt with updated context to generate a new baseline scenario. Never reuse a stale scenario without re-validation against the current system state.

IMPLEMENTATION TABLE

Expected Output Contract

Validate the structured output of the Database Saturation Test Scenario Prompt against this contract before accepting the generated scenario.

Field or ElementType or FormatRequiredValidation Rule

scenario_id

string (slug)

Matches pattern ^db-sat-[a-z0-9-]+$

target_system

object

Must contain 'db_type', 'version', and 'topology' string fields; topology must be one of ['single', 'replica-set', 'sharded', 'cluster']

workload_profile

object

Must contain 'read_write_ratio' (float 0.0-1.0), 'operations_per_second' (integer > 0), and 'query_patterns' (array of objects with 'query_type', 'frequency_pct', and 'avg_result_set_size' fields)

connection_pool_config

object

Must contain 'max_connections' (integer), 'min_connections' (integer), and 'connection_timeout_ms' (integer); max_connections must be >= min_connections

saturation_indicators

array

Each element must have 'metric' (string enum: ['cpu_utilization', 'io_wait', 'lock_contention', 'replication_lag', 'connection_exhaustion', 'disk_queue_depth']), 'threshold' (string with unit), and 'observation_window_seconds' (integer > 0)

index_utilization_checks

array

Each element must have 'index_name' (string), 'expected_usage' (string enum: ['covering', 'partial', 'unused']), and 'validation_query' (string containing EXPLAIN or equivalent)

vacuum_compaction_impact

object

If present, must contain 'estimated_bloat_pct' (float), 'last_maintenance_window' (ISO 8601 datetime string), and 'projected_degradation_pct' (float); required for PostgreSQL and similar MVCC engines

failure_injection_points

array

Each element must have 'component' (string), 'failure_mode' (string enum: ['connection_drop', 'disk_full', 'network_partition', 'replica_failure', 'write_stall']), and 'expected_behavior' (string describing system response)

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when this prompt produces unreliable database saturation scenarios, and how to guard against each failure.

01

Unrealistic Read/Write Mix Ratios

What to watch: The model defaults to generic 80/20 or 50/50 splits without considering the actual application profile, caching layers, or read replicas. This produces scenarios that miss the real saturation point. Guardrail: Require the prompt to derive ratios from provided production metrics, query logs, or application instrumentation. Add a validation step that flags any ratio not traceable to a source input.

02

Missing Index Utilization Assumptions

What to watch: The generated scenario assumes ideal index coverage and ignores missing, unused, or bloated indexes. This hides I/O saturation risks that appear in production when the optimizer scans instead of seeks. Guardrail: Include an explicit index inventory in the prompt input. Add an output check that each query pattern references a specific index or flags a missing-index risk with expected impact.

03

Ignoring Vacuum/Compaction Overhead

What to watch: The scenario models steady-state throughput without accounting for autovacuum, compaction, or statistics refresh operations that consume I/O and CPU during the test window. Guardrail: Require the prompt to include maintenance window timing and expected resource consumption. Validate that the output mentions maintenance operation overlap with the test period and adjusts saturation thresholds accordingly.

04

Connection Pool Sizing Mismatch

What to watch: The model recommends connection pool sizes based on theoretical maximums rather than actual application pool configurations, transaction durations, or connection lifecycle patterns. This leads to scenarios that either underutilize or overwhelm the pool. Guardrail: Feed the prompt actual pool configuration parameters and average transaction duration. Add an output validator that checks pool utilization projections against the scenario's concurrency targets.

05

Single-Axis Saturation Blindness

What to watch: The scenario saturates CPU, I/O, and locks simultaneously, making it impossible to identify which resource is the actual bottleneck. This violates the core testing principle of isolating saturation axes. Guardrail: Add a constraint requiring the scenario to target one primary saturation axis per test phase. Include an output check that each phase declares its target saturation indicator and keeps other resources below 70% utilization.

06

Replication Lag Not Modeled as a Saturation Signal

What to watch: The scenario treats replication lag as a secondary metric rather than a primary saturation indicator, missing the point where read replicas serve stale data under write pressure. Guardrail: Require replication lag thresholds in the SLA inputs. Validate that the output includes lag monitoring as a primary abort condition and specifies the acceptable staleness window for read-after-write consistency checks.

IMPLEMENTATION TABLE

Evaluation Rubric

Score each generated database saturation test scenario against these criteria before approving it for test execution. A passing scenario meets all criteria.

CriterionPass StandardFailure SignalTest Method

Saturation Axis Clarity

Scenario targets exactly one primary saturation axis (CPU, I/O, locks, replication lag, or connection pool) with a measurable threshold

Scenario mixes multiple saturation axes without clear isolation or states 'test everything'

Manual review: identify the single saturation metric and its target threshold in the scenario description

Read/Write Mix Specification

Scenario defines explicit read percentage, write percentage, and operation types (e.g., point reads, range scans, upserts) with ratios that sum to 100%

Missing operation types, ratios don't sum to 100%, or uses vague terms like 'mostly reads'

Schema check: parse [READ_WRITE_MIX] for numeric ratios and operation type enumeration

Query Pattern Completeness

Scenario includes specific query templates with WHERE clause patterns, JOIN depth, and expected index utilization for each operation type

Query patterns are generic (e.g., 'SELECT queries') or omit index utilization assumptions

Manual review: verify each operation type has a concrete query pattern and index assumption stated

Connection Pool Configuration

Scenario specifies initial pool size, max pool size, connection timeout, and expected concurrent connection count at saturation

Connection pool parameters are missing or unrealistic (e.g., pool size 1 for high-concurrency scenario)

Schema check: parse [CONNECTION_POOL_CONFIG] for all four fields with numeric values

Saturation Indicator Thresholds

Scenario defines at least one concrete threshold per monitored resource (e.g., CPU > 85%, replication lag > 5s, lock wait time > 1s)

Thresholds are absent, use relative terms ('high CPU'), or lack units

Schema check: parse [SATURATION_INDICATORS] for numeric thresholds with units per resource

Vacuum/Compaction Impact Assessment

Scenario acknowledges whether autovacuum, compaction, or similar maintenance operations are expected to run during the test and states their expected impact

Scenario ignores maintenance operations entirely or assumes they won't run without justification

Manual review: confirm presence of vacuum/compaction statement and impact assumption in scenario notes

Data Volume and Growth Assumptions

Scenario specifies initial data volume, expected growth rate during test, and whether data is pre-warmed in buffer pool or cold

Missing initial volume, no growth rate, or unclear buffer pool state

Schema check: parse [DATA_VOLUME_CONFIG] for initial size, growth rate, and warm/cold state

Safe-Abort Conditions

Scenario defines at least one concrete abort condition with a metric threshold that triggers test termination (e.g., error rate > 5%, P99 latency > 30s)

No abort conditions defined or conditions are unreachable (e.g., 'system crash' without monitoring)

Manual review: verify at least one abort condition with metric, threshold, and monitoring source

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single database engine and simplified saturation indicators. Replace [DATABASE_ENGINE] with a specific target (e.g., PostgreSQL, MySQL). Reduce [SATURATION_INDICATORS] to 2-3 key metrics (CPU, I/O wait, connection count). Skip replication lag and vacuum/compaction checks initially.

Watch for

  • Missing index utilization assumptions in the generated scenario
  • Overly broad read/write mix ratios that don't match your actual workload
  • No connection pool sizing guidance in the output
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.