Skip to content
ParticleDB
Release candidateParticleDB 1.1.19-rc.17 is not yet GA or ready for production data.Release status →

Analyze live data

The SQL sections below use a small set of application events; run them in a connected SQL client.

An aggregate over live rows, returned to your application:

Uses db from the connect example.

db.execute("CREATE TABLE runs (agent TEXT, ms BIGINT)")
db.execute("INSERT INTO runs VALUES ('planner', 120), ('planner', 90), ('critic', 200)")
print(db.query("SELECT agent, COUNT(*) AS runs, SUM(ms)::BIGINT AS total_ms "
               "FROM runs GROUP BY agent ORDER BY agent"))
Output
[{'agent': 'critic', 'runs': 1, 'total_ms': 200}, {'agent': 'planner', 'runs': 2, 'total_ms': 210}]
CREATE TABLE task_events (
id BIGINT PRIMARY KEY,
team TEXT,
duration_ms BIGINT
);
INSERT INTO task_events VALUES
(1, 'support', 100),
(2, 'support', 300),
(3, 'platform', 200);
SELECT team, COUNT(*) AS runs, AVG(duration_ms) AS mean_ms
FROM task_events
GROUP BY team
ORDER BY team;

The platform team has one run; support has two. Both have a mean duration of 200 milliseconds.

SELECT team, COUNT(*) AS slow_runs
FROM task_events
WHERE duration_ms > 150
GROUP BY team
ORDER BY team;

Each team has one matching run. Real workloads need representative data and query measurements. Small examples demonstrate behavior, not benchmark performance.

Aggregations · Window functions · Query performance