Event schema
Fields the query expects
| Field | Type | Why it exists |
|---|---|---|
| timestamp_utc | Timestamp | Transaction terminal-event time. |
| service | Utf8 | Owning application service. |
| transaction_name | Utf8 | Stable logical transaction class. |
| release | Utf8 | Application release. |
| duration_ms | Float64 | Begin-to-terminal transaction duration. |
| outcome | Utf8 | committed, rolled_back, or timed_out. |
Copy the query
SELECT
service,
transaction_name,
release,
COUNT(*) AS transactions,
approx_percentile_cont(duration_ms, 0.95) AS p95_duration_ms,
MAX(duration_ms) AS max_duration_ms,
SUM(CASE WHEN outcome <> 'committed' THEN 1 ELSE 0 END) AS unsuccessful
FROM database_transaction_events
WHERE timestamp_utc >= now() - INTERVAL '7 days'
GROUP BY service, transaction_name, release
ORDER BY p95_duration_ms DESC, unsuccessful DESC;This read-only query is planned and executed against an empty typed table with Apache DataFusion 45.2.0. We review the synthetic sample output separately. Check field types, thresholds, and counting rules against your own data. Read the testing methodology.
Query result
p95 transaction duration
Invoice finalization has the longest tail and the most unsuccessful outcomes.
| service | transaction_name | release | transactions | p95_duration_ms | max_duration_ms | unsuccessful |
|---|---|---|---|---|---|---|
| billing | invoice-finalize | api-88 | 820 | 6,800 | 24,100 | 28 |
| projects | member-import | api-88 | 240 | 4,210 | 18,200 | 9 |
Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.
Reproduce the example
Download the sample data
The JSON bundle includes the event schema with field types, illustrative input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.
How the SQL works
- 1Transaction class connects duration to an application owner.
- 2The maximum exposes extreme resource holds beside a stable percentile.
- 3Count rollbacks and timeouts alongside commits to include every final transaction result.
Edge cases to check
- Join start and completion events separately to find transactions with no final result.
- Server wait events and lock graphs require database-native diagnostics.
- Do not log statements with bound values.
Recommended dashboard
- Bars: p95_duration_ms by transaction
- Trend: unsuccessful by release
- Table: longest safe transaction events
Alert guidance
Alert when a critical transaction times out or its p95 exceeds an owner-approved bound.
Read alert setupSet up the events this query needs
Related instrumentation and guides
Continue the analysis
Find slow database queries by fingerprint
Rank normalized database operations by slow-query rate, average duration, and worst observed duration without storing raw SQL or parameters.
Open recipeMeasure database connection-pool saturation
Measure average pool utilization, queued acquisition waits, timeouts, and idle capacity by application service.
Open recipeCalculate database transaction rollback rate
Compare committed and rolled-back transactions by service while preserving error categories, duration, and affected accounts.
Open recipeRun it on your events
Create a table, adapt the fields, and save the result
Start free, send structured events, and use the query result as a chart, shared dashboard widget, or alert input.