What Does One Query Cost? Cost Per Query From Timings
In a made-up traffic mix, one kind of query was 2 percent of the traffic and 60 percent of the compute cost. Here is how to find it.
Video #227 ยท Data strategy
Steps in the video
Files
- cost.py (20 lines)
- data.py (23 lines)
- measure.py (50 lines)
Tested with
Python 3.12.15 | duckdb==2.0.0
What this does not show
The rate, the data and the traffic mix are made up. Timings come from one busy laptop with DuckDB on two threads and moved a lot between runs. Storage, network and people are not counted.
Sources
Learning IT by Example.