---
title: "PRAGMA"
description: "PRAGMA is a SQL command for reading or setting database engine configuration and inspecting internal metadata, using syntax outside standard SQL DML/DDL."
canonical: "https://motherduck.com/glossary/pragma/"
related:
  - title: "PRAGMA statements | MotherDuck Docs"
    url: "https://motherduck.com/docs/sql-reference/duckdb-sql-reference/pragma-statements/"
  - title: "DuckLake Architecture Deep Dive: Catalog, Storage, Compute | MotherDuck"
    url: "https://motherduck.com/videos/ducklake-architecture-deep-dive/"
  - title: "DuckDB statements | MotherDuck Docs"
    url: "https://motherduck.com/docs/sql-reference/duckdb-sql-reference/duckdb-statements/"
gated_asset:
  title: "DuckLake on MotherDuck"
  url: "https://motherduck.com/product/ducklake/"
---

# PRAGMA

> PRAGMA is a SQL command for reading or setting database engine configuration and inspecting internal metadata, using syntax outside standard SQL DML/DDL.

## Overview
`PRAGMA` statements are a SQLite-originated convention, also adopted by DuckDB, for engine-level configuration and introspection that doesn't fit neatly into standard `SELECT`/`SET` syntax. They can report metadata (like a table's schema) or change session settings.

```sql
PRAGMA table_info('orders');       -- column names, types, nullability
PRAGMA database_list;              -- list attached databases
PRAGMA version;                    -- engine version info
```

Many `PRAGMA` statements have an equivalent `SELECT * FROM pragma_function_name(...)` form, since under the hood they're often implemented as table-producing functions.

## DuckDB specifics
DuckDB supports a substantial set of `PRAGMA` commands for introspection and tuning, including:

```sql
PRAGMA database_list;                       -- attached databases and their paths
PRAGMA show_tables;                         -- tables in the current database
PRAGMA table_info('orders');                -- column-level schema info
PRAGMA version;                             -- DuckDB version and build hash
PRAGMA memory_limit='4GB';                  -- cap memory usage
PRAGMA threads=4;                           -- cap parallelism
```

Most DuckDB configuration `PRAGMA`s have an equivalent `SET` statement (`SET memory_limit = '4GB'` is the same as `PRAGMA memory_limit='4GB'`), and many introspection `PRAGMA`s are equally usable as table functions, e.g. `SELECT * FROM pragma_table_info('orders')`, which is more composable since it can be filtered, joined, or aggregated like any other query result.