PriceMedic: Sub-Second Queries and $20k Monthly Savings with Hypertenancy on MotherDuck

Because of MotherDuck's serverless model, we can scale up certain customers without scaling an entire cluster. We got a better customer experience without taking a big hit upgrading our entire stack.

Josh Nakka's photo

Josh Nakka

Co-Founder

Josh Nakka company logo

PriceMedic queries a 100TB healthcare pricing data lake to help small practices negotiate better insurance rates. By migrating from Athena and Redshift to MotherDuck's hypertenancy architecture, they cut query times from 7 seconds to 500ms and save ~$20k/month by skipping expensive pre-compute transformations entirely.

Petabytes of Price Data

Healthcare price transparency legislation requires insurance companies to publish negotiated rates monthly—petabytes of data in massive JSON files (up to 2TB each). PriceMedic aggregates this data to help small practices understand what their peers are getting paid and negotiate better rates with insurers.

The scale is staggering: 7 million U.S. providers × 20,000+ procedures × hundreds of networks per insurer. PriceMedic's job is to query their 100TB data lake and extract customer-specific slices (~5M rows each) fast enough to feel interactive.

Their AWS stack—Athena, Redshift, Glue, QuickSight—worked, but pain points compounded. Athena's per-scan billing meant a ~$6,000 monthly bill just for querying, and as a data aggregator, PriceMedic doesn't control how insurers structure their data—so they couldn't optimize partition layouts to reduce scans.

Shared compute pools meant one power user's query could slow everyone down. "There's an error we'd frequently hit in: 'this query is beyond the scale factor,'" explains Josh Nakka, PriceMedic's co-founder. "You'd have to upgrade the whole cluster. It's an expensive error with no other fix." Redshift latency frustrated users—"it would be like seven seconds to run a simple sort"—and QuickSight's refresh cycle broke the real-time experience entirely. Users had to wait for scheduled data ingests instead of seeing live results.

Come to the Duck Side

Nakka discovered DuckDB through Jordan Tigani's "Big Data is Dead" article. After benchmarking against ClickHouse, MotherDuck won on billing model: "ClickHouse liked provisioning everything in clusters. You'd pay for that cluster every single month. MotherDuck was aggressively serverless."

The migration was fast—initial OLAP layer running in three days, with queries transferring nearly 1:1 from Athena SQL. S3 integration was seamless: just swap table references for read_parquet() calls.

Here's PriceMedic's fee schedule interface powered by MotherDuck—20 million rates across 14,000+ billing codes with filtering running instantly:

PriceMedic's fee schedule interface.

Hypertenancy Architecture

The most transformative change was adopting per-customer compute isolation using MotherDuck service accounts–i.e. hypertenancy.

Each customer organization gets a dedicated service account for shared workloads, and each user within an organization gets their own service account for individual queries. This unlocks granular scaling—"we were able to identify specific organizations, and even better, specific users, who need more compute," Nakka explains. "We can scale individually for each one."

It also solves cost attribution. "We can figure out how much we're paying for each customer." No more bespoke tracking systems. Power users no longer slow everyone else down.

The best part: because of MotherDuck's serverless billing, the cost impact is minimal. "The impact to our bottom line is almost negligible (to scale larger cusomers' compute instances). We got better customer experience without taking a big blunt hit upgrading our entire stack."

PriceMedic's compute architecture with MotherDuck.

What Changed

The performance gains unlocked a fundamentally different user experience. Queries on "gold tier" datasets dropped from 7 seconds to under 500 milliseconds—14x faster, and fast enough to feel interactive rather than like waiting on a report. Cold start latency disappeared entirely.

On the BI layer, PriceMedic replaced QuickSight with Omni. What used to require a 2-minute ingest wait now loads in under 3 seconds, and data freshness shifted from scheduled refreshes to real-time.

PriceMedic's reimbursement dashboard.

But the second win was cost. AWS Glue transformations that ran ~$15,000/month were eliminated completely. Athena query costs dropped from ~$6,000/month to a projected ~$600. Total savings: roughly $20,000 per month.

MotherDuck's query performance meant PriceMedic could skip expensive monthly transformations entirely. When queries are fast enough, you don't need to pre-compute.

"We save tens of thousands of dollars each month by not doing that transformation. Users want to see their query results in around seven seconds or less. As long as you can hit that, you can avoid any extra costs. MotherDuck allowed us to fit well within those seven seconds without doing all those expensive transformations."