What’s Supported
- ParadeDB indexes on distributed tables — Create search indexes after distributing tables with
create_distributed_table() - Distributed queries with search operators — Use the
|||(match disjunction) and&&&(match conjunction) operators in queries across sharded tables - Subqueries with LIMIT — Complex queries with subqueries and LIMIT clauses work correctly
- JOIN queries — Search with JOINs across distributed tables
Installation
Bothcitus and pg_search must be added to shared_preload_libraries in the correct order:
Match the Citus version to your Postgres major version: Citus 13 supports
Postgres 15–17, and Citus 14 supports Postgres 16–18.
The order in
shared_preload_libraries matters. Always list citus before
pg_search to ensure proper planner hook chaining.Usage Example
Here’s a complete example of setting up distributed search with Citus:As of
0.25.0, pg_search requires the
pgvector extension because it relies
on pgvector’s vector type. pgvector must be installed on the server
before pg_search is created — CASCADE then runs CREATE EXTENSION vector
automatically if it has not already been created.Verify Distributed Execution
You can verify that both ParadeDB and Citus are working together by examining the query plan:- Citus Adaptive Custom Scan — Coordinating distributed query execution across shards
- ParadeDB Base Scan — Using the ParadeDB index within each shard
- Task Count: 32 — Query distributed across 32 shards (default Citus shard count)
Example EXPLAIN Output
Example EXPLAIN Output
Distributed JOINs with Search
ParadeDB search operators work seamlessly with Citus distributed JOINs:Verify Distributed JOIN Execution
Check the execution plan for distributed JOINs with search:Example EXPLAIN Output for JOIN
Example EXPLAIN Output for JOIN
Nested Loopshows efficient JOIN execution on each shardCustom Scan (ParadeDB Base Scan)on the outer side of the JOIN uses BM25 for filteringIndex Scanon authors table uses the primary key for lookups- JOINs execute locally on each shard for optimal performance
Known Limitations
- ❌ Citus columnar tables — ParadeDB indexes and other PostgreSQL indexes (like GiST, GIN) cannot be created on Citus columnar tables due to limitations in Citus’s columnar storage implementation. However, you can use regular distributed tables with ParadeDB indexes alongside columnar tables for analytics.
Performance Considerations
When using ParadeDB with Citus:- Index creation happens locally on each shard, enabling parallel index building
- Search queries execute in parallel across shards and results are merged by the coordinator
- Distribution column should be chosen based on your query patterns to minimize cross-shard operations