Search Shortcut cmd + k | ctrl + k
cache_prewarm

Prewarm data blocks into DuckDB's buffer pool or OS page cache for faster queries

Maintainer(s): peterxcli, dentiny

Installing and Loading

INSTALL cache_prewarm FROM community;
LOAD cache_prewarm;

Example

-- Prewarm a table into the buffer pool
SELECT prewarm('my_table');

-- Prewarm with specific mode
SELECT prewarm('my_table', 'read');

About cache_prewarm

A DuckDB extension that preloads table data blocks into the buffer pool or OS page cache, inspired by PostgreSQL's pg_prewarm extension.

Prewarm Modes:

  • buffer (default): Load blocks into buffer pool with pin/unpin
  • read: Warm OS page cache without using buffer pool
  • prefetch: Batch prefetch using OS hints

Use cases include cold start optimization and predictable query latency.

Added Functions

function_name function_type description comment examples
prewarm scalar NULL NULL