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

Skip to main content

Building your First App with Customer-Facing Analytics

To get a sense of what the Customer-Facing Analytics experience with MotherDuck can look like, try out the tutorial in the MotherDuck UI.

Customer Provisioning

MotherDuck differs from other databases in that every Duckling is an isolated bucket of compute. For Customer-Facing Analytics, this means that every customer tenant or organization should have one service account for serving data to the end user, and potentially also use that account for data ingestion and transformation. This is managed via the create user and create access token REST API endpoints. Once these accounts are created, the tokens can be used to create databases and load data into MotherDuck and served to customers.

Data Modeling and Loading

One database per customer tenant or organization allows immense horizontal scalability across databases, as each database is tied to a tenant’s service account. As such, the workloads are also isolated from each other, which means that each tenant’s workload can expand appropriately, using differing Duckling sizes (Pulse, Standard, etc).

That being said, it may also make sense to consume initial data using a single service account and then subsequently break out the data transformation into customer-level databases. Connecting multiple databases together is done with ATTACH and leverages zero-copy cloning to make it fast and easy to query.

Differing Models for Data Pipelines

Other Considerations

Since MotherDuck Shares are read-only, in more real-time scenarios it may make sense to use CREATE SNAPSHOT to force a checkpoint on the writer and REFRESH DATABASE to get the latest version of the data on the reader. This will force consistency between the reader and writers.

For higher-scale and high concurrency applications, MotherDuck also offers Read Scaling Replicas, which is helpful for applications that can send 100s or 1000s of queries in a few seconds, like BI tools. Read Replicas can be created and modified in the UI, or via the Create Access Token and Set user instance REST APIs. These Replicas have the same consistency considerations as Shares, and as scuch can be checkpointed and refreshed more frequently if needed.