Join us for a live demo and deep-dive of Instant SQL on May 21Register Now

Skip to main content

Customer-Facing Analytics on MotherDuck

MotherDuck's architecture is designed for the unique requirements of Customer-Facing Analytics (CFA).

  • Per-user tenancy model, providing each of your customers with dedicated databases and compute resources that can scale up, scale down and scale out as needed.
  • Dual Execution. Enabled by the ultra-lightweight architecture of DuckDB, each MotherDuck client is also capable of processing SQL queries. This enables you to provide your customers with nearly instantaneous filtering and drilldown of their data, like Column Explorer and Instant SQL provide for MotherDuck users.

This article will help you understand how the MotherDuck architecture compares to traditional transactional and analytic databases. We’ll also give you some next steps for building your applications.

info

What’s the difference with BI? Business Intelligence (BI) is traditionally built for internal stakeholders—it runs on batch-processed data models, serves a small number of users, and tolerates high-latency queries. In contrast, customer-facing analytics is built directly into your product for end users. It delivers near real-time, low-latency insights at scale—think milliseconds, not minutes—and must handle thousands to millions of concurrent queries. While BI powers strategic decisions in the boardroom, user-facing analytics drives engagement and value directly in the app experience.

Architectural Considerations

For many types of applications, the data sits in a transactional database (OLTP database) like Postgres or MySQL. Engineers building CFA features often run analytical queries directly in a multi-tenant transactional database, which works fine until things break down at scale. Row-based storage and transactional databases simply aren’t designed for efficient analytical querying.

Crying Database

Switching to a database and query engine designed for analytics is the first step. However, many of the legacy OLAP engines were designed with only the internal analytics/bi use case in mind. They are provisioned as a single instance (or cluster) for all customer data, leading to overprovisioning of resources for peak load and a terrible ‘noisy neighbor’ problem in addition to latency and underlying security concerns.

Crying Database

MotherDuck provisions a Duckling (DuckDB instance) for each of your customers (or even for each of your customers’ users) for these use cases. This "hyper-tenancy" model isolates customer data and provides the same great DuckDB-powered experience for each individual user. Critically, this means as your application scales, you can simply add more capacity for your users in a much more cost effective way than a traditional database architecture.

Happy Database

Scaling Analytics Up and Out

Each of your customers (and possibly each of their users) has their own MotherDuck Duckling (DuckDB instance). This means that one account could run several hundred or thousands of Ducklings at a given time, or none at all. This type of serverless model is at the heart of MotherDuck's advantage versus other engines. And of course, it's not just limited to more Ducklings: What if a customer needs to have more compute power or memory? MotherDuck has several instance sizes to scale up for even larger workloads.

MD router

You can scale vertically by upgrading (or downgrading) the instance size your application uses for each customer, enabling you to provide more power for more important customers. This is likely all you need to scale your application for customers, but if you need even more compute or the ability to handle high concurrency, you can launch read scaling Ducklings for your compute-hungry customers.

Dual Execution for Zero-Latency Data Exploration

As you're building Customer-Facing Analytics into your product, you want to provide an experience that wows your customers. Legacy data warehouses rarely provide sub-second response times, making it difficult to enable your customers to quickly explore their data. MotherDuck, through the efficiency of DuckDB, already makes this better with faster query response times, but what if you want near-zero latency?

3tier

Because the same DuckDB SQL engine runs on both MotherDuck Ducklings and on your customers’ machines, you can offload some data processing to their laptops and provide instant data exploration, filtering, sorting, etc using SQL queries. Customers don’t even need to install anything on their computers as DuckDB runs inside the web browser using a technology called Web Assembly (Wasm).

wasm

You can see examples of the experience enabled by this architecture by checking out Column Explorer and Instant SQL in the MotherDuck UI. Here’s a teaser of it in action:

instant sql

Getting started with Customer-Facing Analytics and MotherDuck

To get started with Customer-Facing Analytics and MotherDuck, check out our Getting Started with Customer-Facing Analytics page.