> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MotherDuck SQL observations

> Read a remote DuckDB relation through MotherDuck's PostgreSQL wire endpoint.

Mount [`@bijectionhq/app-sql`](https://docs.bijection.com/integrations/native-sql#mount-and-bind) once
per relation. Use the PostgreSQL wire endpoint published by your MotherDuck
region and pass the receiver as `provider`.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
export const remote = postgresRelation(
  "pg.us-east-1-aws.motherduck.com:5432", credential, data,
);
```

Seal a scoped MotherDuck read token in this receiver credential. Bind the receiver and the mount under the same `data` label and
initialize the source. The wire requires direct verified TLS on port 5432.

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "token": "<MotherDuck read token>",
  "path": ["analytics", "main", "items"],
  "key": "id",
  "columns": ["name", "quantity"],
  "incarnation": "analytics-items-1"
}
```

The path names the database, schema and relation. Supply one unique,
non-null BIGINT key and up to fifteen projected columns. DuckDB SQL runs in
MotherDuck. It casts projected values to text, preserving nulls and the
exact decimal key. Record keys are one-element JSON arrays of decimal text.
Each answer carries up to 32 rows and 48 KiB of encoded result data.

The next page reads strictly above the last committed key. Each SELECT can
observe concurrent changes. Sweeps start again after the final page, and
missing keys remain. Change the installed incarnation after a relation
replacement or token rebind to a different underlying share. An embedded
DuckDB file needs a separately supported receiver service.

[MotherDuck PostgreSQL wire endpoint](https://motherduck.com/blog/motherduck-now-speaks-postgres/)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.