Skip to main content
We don’t recommend running pg_duckdb directly on your PlanetScale Postgres database as it can consume significant resources during analytical queries. If you want to use DuckDB for analytics, we recommend using MotherDuck to host your analytical workloads separately.

Dashboard Configuration

This extension requires activation via the PlanetScale dashboard before it can be used. It must be enabled through shared libraries and requires a database restart. To enable pg_duckdb:
1
From the PlanetScale organization dashboard, select the desired database
2
Navigate to the Clusters page from the menu on the left
3
Choose the branch whose extensions you’d like to configure in the “Branch” dropdown
4
Select the Extensions tab
5
Enable pg_duckdb and configure its parameters
6
Click Queue extension changes to apply the configuration
7
Once you’re ready to apply the changes, click “Apply changes

Parameters

duckdb.postgres_role

  • Type: String
  • Default: pscale_superuser
  • Description: Specifies the Postgres role that is allowed to use DuckDB execution and manage secrets.

duckdb.memory_limit

  • Type: Integer
  • Default: 0
  • Description: Maximum memory DuckDB can use per connection in megabytes. Setting to 0 activates DuckDB’s default (80% of available RAM).

Usage

After enabling the extension through the dashboard, you can install it in your database:
CREATE EXTENSION IF NOT EXISTS pg_duckdb;
Once installed, you can use DuckDB’s analytical capabilities directly from PostgreSQL. For example:
-- Query PostgreSQL tables using DuckDB's analytical engine
SELECT * FROM duckdb.read_parquet('s3://bucket/data.parquet');

External Documentation

For more detailed information about pg_duckdb usage and functionality, see the official pg_duckdb documentation.