PrefectHQ
prefect
BlogDocsChangelog

perf: run read and count queries concurrently in paginate endpoints

#20049
Comparing
parallelize-paginate-queries
(
46e6c1c
) with
main
(
0c5b067
)
CodSpeed Performance Gauge
0%
Untouched
2
Ignored
6

Benchmarks

Passed

bench_import_prefect_flow
benches/bench_import.py
CodSpeed Performance Gauge
0%
1.4 s1.4 s
bench_task_decorator
benches/bench_tasks.py
CodSpeed Performance Gauge
0%
602.6 µs602.5 µs

Ignored

bench_flow_call[options0]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
-2%
165.9 ms169.4 ms
bench_flow_decorator
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
-5%
5 ms5.3 ms
bench_task_call
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
-5%
31.2 ms32.8 ms
bench_flow_call[options1]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
107.6 ms107.6 ms
bench_import_prefect
benches/bench_import.py
Ignored
CodSpeed Performance Gauge
0%
1.1 s1.1 s
bench_task_submit
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+34%
12.1 ms9.1 ms

Commits

Click on a commit to change the comparison range
Base
main
0c5b067
+0.06%
perf: parallelize read and count queries in paginate endpoints Use asyncio.gather() to run read and count queries concurrently in flow_runs/paginate and task_runs/paginate endpoints instead of awaiting them sequentially. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
b6b921e
14 hours ago
by zzstoatzz
-0.02%
fix: use separate sessions for concurrent queries SQLAlchemy async sessions don't support concurrent operations on the same session. Each query now gets its own session context so they can execute concurrently without conflicts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
46e6c1c
13 hours ago
by zzstoatzz
© 2025 CodSpeed Technology
Home Terms Privacy Docs