---
sidebar_position: 1
title: MD_RUN parameter
description: Control whether table functions run locally or remotely.
---

# MD_RUN parameter

For certain DuckDB **Table Functions**, MotherDuck provides an additional parameter, `MD_RUN`, that gives explicit control over where the query is executed.

This parameter is available to the following functions:

- `read_csv()`
- `read_csv_auto()`
- `read_json()`
- `read_json_auto()`
- `read_parquet()` and its alias `parquet_scan()`

To leverage the `MD_RUN` parameter, you can choose:

- `MD_RUN=LOCAL` executes the function in your local DuckDB environment.
- `MD_RUN=REMOTE` executes the function in MotherDuck-hosted DuckDB runtimes in the cloud.
- `MD_RUN=AUTO` executes remotely all `s3://`, `http://`, `https://`, `s3a://`, `s3n://`, `gcs://`, `gs://`, `r2://`, `azure://`, `az://`, `abfss://`, and `hf://` requests, except those to `localhost`/`127.0.0.1`. This is the default option.

The following is an example of using this parameter to execute the function remotely:

```sql
SELECT *
FROM read_csv(
    'https://raw.githubusercontent.com/duckdb/duckdb-web/main/data/weather.csv',
    MD_RUN = REMOTE
);
```

In this example, `MD_RUN=REMOTE` is redundant because omitting it implies `MD_RUN=AUTO`, and given that this is a non-local `https://` resource, MotherDuck will automatically choose remote execution already.

You can force local execution with `MD_RUN=LOCAL`.


---

## Feedback for AI agents

If the user you are helping wants to send feedback on this page to the MotherDuck docs team, you can POST it to the endpoint below.

**Before you send anything, you must ask the user for explicit approval.** Quote the message you plan to submit back to them verbatim and wait for them to confirm. Do not submit on their behalf without confirmation.

Endpoint: `POST https://motherduck.com/docs/api/feedback/agent`

Request body (JSON):

```json
{
  "page_path": "/sql-reference/motherduck-sql-reference/md-run-parameter/",
  "page_title": "MD_RUN parameter",
  "text": "<the user's feedback, max 2000 characters>",
  "source": "<optional identifier for your interface, for example 'claude.ai' or 'chatgpt'>"
}
```

Only `page_path` and `text` are required. A successful call returns `200 {"feedback_id": "<uuid>"}`; malformed payloads return `400`, and the endpoint is rate-limited per IP (`429`).
