How to Check ParadeDB Memory Usage in PostgreSQL

Galaxy Glossary

How do I check ParadeDB memory usage in PostgreSQL?

paradedb.memory_usage() returns detailed shared-buffer and local memory statistics for all ParadeDB indexes in the current PostgreSQL database.

Sign up for the latest in SQL knowledge from the Galaxy Team!
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.

Description

Table of Contents

Why monitor ParadeDB memory usage?

Memory-heavy vector indexes can slow queries and evict useful data from shared buffers. Frequent checks help you tune work_mem, shared_buffers, and autovacuum settings before problems appear.

What does paradedb.memory_usage() show?

The function lists each ParadeDB index, its size on disk, the portion cached in shared buffers, local work_mem consumed by the last operation, and the percent of total shared_buffers in use.

How do I call paradedb.memory_usage()?

Run the function in any database where the ParadeDB extension is installed. Superuser rights are not required because the view is SECURITY DEFINER.

Step-by-step example

1. Connect to your analytics database.
2. Execute SELECT * FROM paradedb.memory_usage();
3. Review the shared_mb and work_mem_mb columns for spikes.

How to interpret the output?

shared_mb > 75% of shared_buffers signals pressure; increase shared_buffers or drop rarely used indexes. work_mem_mb > current work_mem means sorts spilled to disk; raise work_mem or batch your queries.

Best practices for ParadeDB memory

Create indexes only on frequently searched embeddings. Use VACUUM (INDEX_CLEANUP) after large deletions to reclaim space. Schedule REINDEX during low-traffic windows to shrink bloat.

Common mistakes

Creating huge HNSW indexes without raising shared_buffers leads to cache eviction. Forgetting to set maintenance_work_mem high enough slows bulk index builds.

Related questions

See the FAQ below for quick answers on permissions, overhead, and automation.

Why How to Check ParadeDB Memory Usage in PostgreSQL is important

How to Check ParadeDB Memory Usage in PostgreSQL Example Usage


-- Example: Find ParadeDB indexes consuming over 500 MB shared memory in an ecommerce DB
SELECT table_name, index_name, shared_mb
FROM paradedb.memory_usage()
WHERE shared_mb > 500
ORDER BY shared_mb DESC;

How to Check ParadeDB Memory Usage in PostgreSQL Syntax


-- Enable extension (once per database)
CREATE EXTENSION IF NOT EXISTS paradedb;

-- Check memory usage for all ParadeDB indexes
SELECT *
FROM paradedb.memory_usage();

-- Filter for a single table (e.g., Products embeddings index)
SELECT *
FROM paradedb.memory_usage()
WHERE table_name = 'products';

Common Mistakes

Frequently Asked Questions (FAQs)

Do I need superuser rights to run paradedb.memory_usage()?

No. The function is SECURITY DEFINER and executable by any user with USAGE on schema paradedb.

How often should I check memory usage?

Run it daily in staging and production or hook it into pg_monitor dashboards for real-time alerts.

Can I automate cleanup when memory is high?

Yes. Combine the query with a cron job that triggers REINDEX or VACUUM when shared_mb crosses a threshold.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.