---
title: "Comment by Mason, HoopVision Lab on \"Rebuilding by Removing: How I Made My Sports Analytics Pipeline 20x Faster\" | Hashnode"
description: "Four containers for a research tool with one user is a trap I recognise. Our NBA stat site went the other way: it computes everything per request from recorded"
url: "https://hashnode.com/posts/rebuilding-by-removing-20x-faster-sports-analytics-pipeline/69e9bf062fb2fc72b4cfb9e6/comment/6b035d74bd3fc726d5f262e8"
---

[Discussion](https://hashnode.com/posts/rebuilding-by-removing-20x-faster-sports-analytics-pipeline/69e9bf062fb2fc72b4cfb9e6)

Comment [Rebuilding by Removing: How I Made My Sports Analytics Pipeline 20x Faster](https://hashnode.com/posts/rebuilding-by-removing-20x-faster-sports-analytics-pipeline/69e9bf062fb2fc72b4cfb9e6)

[Mason, HoopVision Lab](https://hashnode.com/@hoopvisionlab)

[Nov 22](https://hashnode.com/posts/rebuilding-by-removing-20x-faster-sports-analytics-pipeline/69e9bf062fb2fc72b4cfb9e6/comment/6b035d74bd3fc726d5f262e8)

Four containers for a research tool with one user is a trap I recognise. Our NBA stat site went the other way: it computes everything per request from recorded box scores, no queue, and shows the query behind each number so you can check it. Curious what you did with the nine detection methods after the rewrite: do they all run per request now, or did you cache the slow ones?

[Madukoma Blessed](https://hashnode.com/@mblessed)

[Nov 23](https://hashnode.com/posts/rebuilding-by-removing-20x-faster-sports-analytics-pipeline/69e9bf062fb2fc72b4cfb9e6/comment/6b035d74bd3fc726d5f262e8#reply-6b03d755a9c0a721456cd941)

Hi Mason, I actually do both. Here's an in-depth description:

1.  Every detector runs in the request: the API loads the event's results from DuckDB over Postgres and runs the method there, with no queue.
2.  Results are cached (in Redis) by event, method, parameters and filters: one day for a single method, seven days for the precision and recall evaluation against sanctioned athletes, because the results only change when I re-scrape.

The exception is comparing all methods at once, which takes 30 seconds to 2 minutes, so that one runs as a background task you poll. Showing the query behind each number is a good idea. I might borrow it.

[Mason, HoopVision Lab](https://hashnode.com/@hoopvisionlab)

[Nov 23](https://hashnode.com/posts/rebuilding-by-removing-20x-faster-sports-analytics-pipeline/69e9bf062fb2fc72b4cfb9e6/comment/6b035d74bd3fc726d5f262e8#reply-6b04aeba66ccfbd613e43cb9)

Thanks for the detail. Per-request for the cheap path and a polled background task for the 30 s to 2 min comparison is the split I'd pick too. Keying the cache on event, method, parameters and filters with a TTL tied to your re-scrape makes sense. Do you also clear the entries on a re-scrape, or just let the seven days run out? And borrow away on the query-under-the-number idea.
