ParadeDB pg_search for BM25 full-text search in PostgreSQL

ParadeDB pg_search adds BM25 ranking, facets and aggregations to PostgreSQL. This page explains when it fits, what the AGPL license means for your deployment, and how the work is scoped.

On this page

When ParadeDB pg_search is the right search layer for PostgreSQL data

ParadeDB's pg_search is the right search layer when your application already keeps its data in PostgreSQL, your queries need BM25 relevance ranking, and you also need filters, facets and aggregations over the same rows. Teams usually reach this point after LIKE patterns become slow and tsvector queries return results that are hard to rank. The extension adds a custom index type to PostgreSQL that supports full-text and vector search with BM25 scoring, filters, facets, aggregations and joins, so search results can stay in the same transaction and access model as the source tables. If your search needs are mostly exact matches, simple prefix lookups or ranking by a few columns, built-in full-text search may be enough, and adding an extension will only add another component to operate.

The decision point is usually whether search has become a product feature that needs relevance tuning, faceted navigation and aggregations across large text columns. Before you commit, load a representative copy of your largest searchable table and measure index build time, index size, write overhead on inserts and updates, and query latency with the filters your users actually apply. Confirm with ParadeDB which PostgreSQL major versions the current pg_search release supports, since the extension must be kept in step with each PostgreSQL upgrade. Also confirm how the index is rebuilt after a restore and whether it is included in your backup and replication plan, because a search index that is missing after recovery is a production gap.

The ParadeDB repository is licensed under AGPL-3.0, and that license applies to the code you obtain from it. Whether AGPL-3.0 obligations affect your deployment depends on how you distribute or offer the software to others, including over a network, and that is a question for your legal counsel rather than this page. Include the license review in your early planning so it does not surface after the build is underway. For the project's own description of its scope and licensing, read the ParadeDB repository before the evaluation starts.

What pg_search adds to a PostgreSQL database

pg_search adds a search index type to PostgreSQL so that ranked text queries, filters, facets and aggregations run beside the tables they describe. The cards below cover what the extension provides, how it is queried, and what your team should verify against the version you plan to deploy.

BM25 ranked full-text search

pg_search scores matching rows with BM25, the ranking approach that weighs how often a term appears in a document against how common it is across the collection. Teams moving from built-in full-text search usually notice the difference first in result ordering, so test ranking with real queries from your application before you switch. Confirm in the ParadeDB repository which BM25 parameters and tokenizers your release exposes.

ParadeDB repository

Vector search alongside text

The extension also covers vector search, so one query can combine similarity ranking with keyword ranking and structured filters. Whether this replaces a separate vector store depends on your embedding volume, recall targets and index build needs, and pgvector is the other option to compare. Confirm the vector functions and index options in the repository for the release you intend to run.

Filters, facets and aggregations

Facets and aggregations are where search engines and relational queries most often diverge in cost. pg_search runs filters, facet counts and aggregations inside the same index-backed query, which keeps result pages consistent with the counts shown beside them. Measure facet latency on your largest tables, because counts over high-cardinality fields can dominate response time.

Joins with relational tables

Because the index lives in PostgreSQL, search results can join to customer, product or permission tables in the same statement. This avoids copying records into a second system, but it means joined columns must be indexed in a way that supports your query plan. Review the join support described in the repository for your version before designing the schema.

Custom index type and SQL access

pg_search defines its own index type, so search is created and queried with SQL statements that your application and migration tools already manage. Index definitions, build time and disk use become part of your schema review and backup planning. Confirm the exact index syntax and any extension upgrade steps in the ParadeDB repository before adding it to a PostgreSQL major upgrade plan.

AGPL licensing review

The ParadeDB repository is licensed under AGPL-3.0, which is a stronger copyleft license than the PostgreSQL License that covers the database itself. Your legal and procurement teams should review what counts as modification and network use for your deployment, especially if you offer the software to users over a network. This is a licensing question to confirm with counsel, not a conclusion this page reaches.

PostgreSQL licence

Configuration decisions before you install pg_search

This table compares the configuration choices to settle before installing pg_search, including which tables to index, tokenizer and language settings, vector fields, write-heavy tables and where search runs. Read each row as a decision: the option, its trade-off and the conditions under which it fits.

DecisionOptionTrade-offWhen to choose it
Tables and columns to indexIndex only the searchable text and the filter fields used in queriesSmaller indexes and faster writes, but new search needs may require a reindexSearch covers a defined set of documents such as product, ticket or article text
Tables and columns to indexIndex every text column in a wide tableLarger index and more write work, with more chances to match noiseRarely justified; reserve for small tables where every column is user-facing
Tokenizer and languageUse the default tokenizer for mixed or unknown contentPredictable behavior, but stemming and stop words may not match your languageData is in one language or includes identifiers, codes and product names
Tokenizer and languageConfigure a language-specific tokenizer and stemming per indexBetter recall for natural language, but each index is tied to that choiceContent is mostly in one language and users search with inflected forms
Vector fieldsKeep vector search in a separate index or toolSimpler index design, but hybrid ranking needs extra integration workSemantic retrieval is a separate workload already served by another system
Vector fieldsIndex embeddings alongside BM25 fields in the same tableOne query surface for keyword and similarity, with more index size to plan forUsers need keyword and semantic results combined in one ranked list
Write-heavy tablesKeep the search index on a table with frequent updates and monitor index write costEach insert or update adds index maintenance work on the primaryUpdates are moderate and search freshness matters to users
Write-heavy tablesMove searchable content to a narrower table fed by controlled updatesExtra sync logic to build and maintain, with a freshness delayIngest rates are high and the search index does not need every change immediately
Where search runsRun search queries on the primarySimplest setup, but heavy search load competes with transactional workQuery volume is low and the database has spare capacity
Where search runsRun search queries on a read replicaIsolates read load, but replicas lag and index state must be verified thereSearch volume is high or must not affect writes; confirm pg_search support on replicas with ParadeDB before you design around it

What the AGPL-3.0 license and index design mean for your deployment

The ParadeDB repository is licensed under AGPL-3.0, and that choice matters more than most database extensions because the license reaches network use, not just distribution. If you run a modified version of pg_search and let users interact with it over a network, the AGPL can require you to offer those users the corresponding source code of your modifications. Using the unmodified extension internally, without offering it to outside users, generally carries a lighter obligation, but the exact boundary depends on how your applications, internal tools and any customer-facing features connect to the database. Have counsel review your intended use before you build, especially if you plan to patch the extension, embed it in a product, or provide search as a service to customers. Confirm the license text and any dual-licensing terms directly in the ParadeDB repository before the review starts.

The index is the main operational cost. A BM25 index is a separate structure that must be written every time a row it covers is inserted, updated or deleted, so write amplification grows with the number of indexed columns and the rate of change in the source table. Index size also depends on the fields you choose to index and the tokenization you configure, so measure the index on a copy of your real data rather than estimating from row counts. Two items need planning up front. First, a PostgreSQL major upgrade changes the server version the extension must match, so confirm with ParadeDB which pg_search release supports your target PostgreSQL major before you schedule the upgrade, and plan a reindex or rebuild step in the runbook if the vendor requires one. Second, the index lives in the primary's write path and is replicated through the WAL like any other change, so measure standby replay lag under peak write load, and confirm that your failover tooling promotes a standby whose index is in a consistent, usable state.

How a pg_search rollout runs from test index to production

The sequence moves pg_search from a compatibility check to a tested, monitored index in production, with each step producing evidence the next step depends on. Nothing reaches production until ranking, filters and write impact have been measured against a copy of your data.

  1. Confirm PostgreSQL and extension compatibility

    Confirm which PostgreSQL major version you run and whether your planned pg_search release supports it, using the ParadeDB repository's compatibility notes and your own version pinning. Check the PostgreSQL versioning policy for the support window of your current major, since that window sets when you must upgrade anyway. Also confirm the AGPL-3.0 license terms with your legal team before anything ships. The output is a written compatibility record naming the PostgreSQL major, the extension version, the license review outcome and the upgrade date you are working toward.

  2. Build the index in a non-production copy

    Restore a recent copy of the production database to a staging environment that matches its PostgreSQL version and configuration. Create the pg_search index on the tables and columns you intend to search, and record how long the build takes and how much disk it uses. Keep the copy's schema identical to production so that index definitions can be moved without edits. The output is a built index in staging, a saved index definition file and a measured build log that operations can compare with production sizing.

  3. Validate ranking and filter results

    Write a set of known queries with expected results, drawn from real user searches and reviewed by the team that owns the data. Run each query against pg_search and against your current search path, such as built-in full-text search or an existing search service. Check that the top results, filters, facet counts and aggregations match what the business expects, and document every difference with its cause. The output is a signed-off query set with pass or fail results and a list of accepted differences.

  4. Measure write and query impact

    Replay a representative write workload against the staging copy and measure insert, update and delete latency with the index in place, comparing it with a baseline without the index. Run the search queries under concurrent load and record latency percentiles and resource use on the database server. Note how index maintenance interacts with autovacuum and disk I/O on your hardware. The output is a comparison table of write and query performance that tells the team whether the indexing cost is acceptable for their workload.

  5. Plan the cutover and rollback

    Decide how the application switches from the old search path to pg_search, whether by feature flag, by query routing or by a staged group of users. Write the rollback steps in the same level of detail as the cutover, including how to disable the new query path and whether the index can stay in place without affecting writes. Agree which team can trigger each step and how the decision is recorded. The output is a runbook with a tested rollback procedure that was rehearsed on the staging copy.

  6. Deploy the index and run the cutover

    Create the index on production during a window your change process approves, after confirming disk headroom and a current backup or restore point. Watch the build and the first write and query traffic closely, and switch query routing in the agreed stages. Keep the old search path running until the new path has passed its checks under production load. The output is a production index in service, a log of the cutover steps and a confirmation that the old path can still be used if needed.

  7. Set monitoring and review after go-live

    Add dashboards and alerts for index size, write latency on the indexed tables, query latency and error rates, and disk growth, using whatever monitoring stack your team already operates. Schedule a review of the monitoring data against the staging baseline, and repeat the known query set after a PostgreSQL minor update or an extension upgrade. The output is a monitored production index, documented alert thresholds set from the measured baseline, and a retest schedule owned by a named team.

What drives the effort and cost of a pg_search implementation

This table lists the factors that change the scope of a pg_search build and explains how each one moves cost up or down. Use it to shape the questions you put to a partner before you ask for a quote. The main takeaway is that index design, tuning and upgrade cadence usually matter more to the total effort than the installation itself.

DriverWhy it changes effort or costHow to keep it down or what to ask for
Number of tables and indexed columnsEach BM25 index covers specific tables and fields, so every added table or column adds index design, mapping and testing work.Limit the first release to the tables that serve named search use cases. Ask the partner to quote per index and to list each table and field in scope.
Write volume on indexed tablesFrequent inserts and updates keep the search index busy, which affects load testing, sizing and how changes reach the index.Measure peak write rates on the source tables before design. Ask the partner how index updates are tested under your peak load and what monitoring they will set up.
Relevance tuning effortBM25 ranking, field weighting and analyzer choices need test queries, judged results and repeated adjustment with your users.Agree a fixed set of representative queries and acceptance criteria up front. Ask for tuning rounds to be listed as a separate, bounded item in the quote.
Access control on search resultsSearch results must respect the row and column rules your database already enforces, which needs design and verification against each role.Document which roles can see which records. Ask the partner to test filtered results per role and to state whether the quote covers that testing.
Data volume and index sizeLarger tables produce larger indexes, which increase build time, disk and memory needs, and the cost of rebuilds and restores.Provide current row counts, growth rates and text sizes. Ask for sizing estimates for disk and memory at your projected volume, and for the rebuild procedure.
Expected PostgreSQL major upgradesThe extension must be matched to each PostgreSQL major version, so every planned major upgrade adds compatibility testing and possibly index rebuilds. PostgreSQL 14 is supported until November 12, 2026, per the PostgreSQL versioning policy.Confirm the extension version that supports your target PostgreSQL version and the upgrade order. Ask the partner to include upgrade testing in the platform life estimate.

How application writes, the pg_search index and search queries connect

The diagram starts with the application writing rows into PostgreSQL tables. The pg_search index is maintained inside the same database, so the search index changes when the table changes. Search queries also come from the application through SQL, and the database's access control and audit logging sit inside the trust boundary. Streaming replication then copies changes to standby servers, so check that standbys carry the same index and the same logging controls as the primary before relying on them for search.

Writes, index maintenance, search queries and replication inside one trust boundary.

How pg_search connects to the rest of your stack

How do application search endpoints call pg_search indexes?

Your application sends search queries to PostgreSQL through its existing database driver, so the search endpoint runs SQL that uses the pg_search index for BM25 ranking, filters and facets. The integration work is in the query layer: mapping user input to search predicates, returning scores and facet counts in the response shape your front end expects, and setting statement timeouts so a heavy aggregation cannot hold a connection. Confirm the exact query syntax, supported operators and facet behavior against the ParadeDB documentation for the version you plan to run, and test your most expensive queries against production-sized data before you commit to an endpoint design.

Does pg_search work with streaming replication and read replicas?

pg_search lives in the database, so its indexes travel with the data through physical replication, but you must confirm that the extension is installed on every standby and that the standby can run it in a hot standby role. Search queries that read from replicas will only return results as current as replication lag allows, which matters for features like a product catalog that changes minute by minute. PostgreSQL supports hot standby servers that serve read-only queries and both synchronous and asynchronous replication, so decide which mode you need and test the index behavior after a failover. Ask ParadeDB whether index writes are supported on standbys and how promotion affects the index.

How do backups and restores handle pg_search indexes?

A PostgreSQL backup taken with a base backup and archived WAL files includes the extension's index data, so point-in-time recovery restores search in the same state as the tables. The open questions are restore time and whether the index can be rebuilt independently if it becomes corrupted. Plan for the case where you restore a logical dump to a new major version, because the extension must be installed with a matching version before the restore runs. Measure how long a full index rebuild takes on your largest table, and include that time in your recovery time objective. Continuous archiving supports point-in-time recovery, and pg_basebackup can produce incremental backups that pg_combinebackup reconstructs at restore time, so confirm that your chosen tool handles the extension's files correctly.

How do I monitor pg_search indexes alongside PostgreSQL?

Monitor the search workload with the same stack you use for PostgreSQL, and add checks specific to the index. Track query latency for search endpoints, index size on disk, vacuum activity on indexed tables, and replication lag for standbys that serve search. Standard PostgreSQL statistics views show how often statements run and how long they take, which is the first place to look when search slows down. Confirm which statistics pg_search exposes, if any, and whether index build or merge operations appear in logs. Teams commonly use Prometheus with Grafana or Zabbix for this, so decide which tool owns the alerts and who receives them before the workload goes live.

How should PostgreSQL roles and application authorization control search results?

There are two layers, and both need a design. PostgreSQL roles control which database users can read the tables and call the search functions, enforced through grants and, where needed, row-level security policies. The application's authorization layer decides which documents a signed-in user may see, and it must apply the same rules to search results. If search runs under a shared application role, the database cannot enforce per-user visibility, so the application must filter results or you must map users to database roles. Test that search never returns a record the user could not open through the normal API, including facet counts, which can leak information about hidden records. Confirm how row-level security interacts with the extension's index before relying on it.

What does ParadeDB's AGPL-3.0 license mean for an internal search service?

The ParadeDB repository is licensed under AGPL-3.0, which governs how you distribute and, in some cases, how you offer modified software over a network. Internal use without distribution often raises fewer obligations, but the answer depends on how you deploy, modify and expose the extension, so have your legal team review it before you build a customer-facing product on top. Record the exact version you run, keep the license text with your deployment records, and check whether any changes you make to the extension must be published. This is a licensing question for counsel, not a technical one, and DeployOpen does not provide legal advice on license terms.

Who in our organization needs to own the search integration?

Three teams usually share the work: the application team owns queries and result handling, the database team owns installation, upgrades, replication and backups, and the security team owns role design and review of the authorization rules. Assign one owner for the index lifecycle, including rebuilds after upgrades and PostgreSQL major version moves, because the extension must stay in step with the server. If you engage a partner, the written scope should state which of these responsibilities they take on and which remain with your staff, and who maintains the integration after handover.

What should we confirm about pg_search upgrades alongside PostgreSQL upgrades?

Confirm that the pg_search version you choose supports your current and target PostgreSQL major versions before you start a major upgrade. PostgreSQL releases a new major version about once a year and supports each for 5 years, so the extension's compatibility matrix needs checking at every planned upgrade. Test the pairing in a staging copy that holds production-sized data, and check whether the extension must be rebuilt or reindexed after the major upgrade. Ask ParadeDB for its support policy and release notes, and schedule the extension update in the same change window as the PostgreSQL upgrade so the two do not drift apart.

When a separate OpenSearch cluster fits better

A dedicated search cluster is the better fit when search is the main product of the workload rather than a feature of an application that already runs on PostgreSQL. Typical cases are log analytics, security analytics, observability data and search across many indices with heavy aggregation, where the data volume, retention rules and ingest pattern belong to a search system. OpenSearch is a reasonable candidate for that role. All software in the OpenSearch project is released under the Apache License, Version 2.0, and the OpenSearch FAQ does not describe a paid edition, so the licensing question is simpler than with AGPL-3.0 components that you may need to review with counsel. OpenSearch is also wire-compatible with Elasticsearch 7.10, which can matter if existing clients, tooling or saved queries were written against that API. Confirm the compatibility details for your own client libraries before you rely on them.

Security requirements can also decide the question. The OpenSearch Security plugin provides role-based access control, document-level and field-level security, field masking, audit logs and TLS for node and client traffic, and it supports SAML, OpenID Connect, LDAP and other authentication backends. If your audit scope needs field-level restriction on search results or a separate audit trail for search access, check whether those controls meet your written requirements before you choose PostgreSQL for search. Also plan version currency. OpenSearch versions move into maintenance, where they receive bug fixes and security patches but no new features, and the release page lists end-of-life dates. Choose a minor line that is supported for your planned operating period and schedule upgrades against the OpenSearch releases page.

Before you decide, compare the operating cost of two systems with the cost of keeping data in sync. A second cluster adds hosts, certificates, backups, monitoring, patching and an upgrade calendar, and someone must own each of them. Synchronization adds a pipeline that copies rows from PostgreSQL, handles deletes and updates, and detects drift between the two stores. For an illustrative case, a team with a modest document corpus that changes slowly may find that pg_search in the existing database removes the pipeline entirely, while a team ingesting high-volume logs may find the reverse. Ask a partner to model both options against your ingest rate, retention, access rules and recovery targets, and make the sync design a written part of the scope.

Questions teams ask before bringing in a partner for pg_search

What drives the cost of a pg_search implementation?

The biggest cost drivers are the size and shape of the data to index, the number of search fields, facets and aggregations, the number of source systems feeding the index, and how many environments must be built and tested. Cost splits into one-time work (design, index build, query tuning, integration, testing and handover) and recurring work (patching the extension, reindexing after changes, monitoring and support). Ask any partner for a written quote that lists each deliverable, the environments covered, who writes and runs the tests, and which items recur after handover. DeployOpen does not publish prices, and a quote follows from the written scope.

How long does a pg_search project take, and what sets the duration?

Duration depends mostly on how many search use cases are in scope, how clean the source data is, and how many systems must keep the index in sync. A single search function over one table is far shorter than relevance tuning across several joined tables with filters and facets. Other factors include how much query testing your team can review, change approvals in your environment, and whether a staging copy of production data is available. Ask for a timeline tied to named milestones and confirm which milestones depend on your team's availability.

What must our team provide before a partner starts?

Plan to provide access and information rather than code. You will need a PostgreSQL version that the extension supports in your environment (confirm the supported pairing with the ParadeDB repository), a non-production database with representative data, the list of search queries users actually run, and the field and relevance rules the business expects. You also need a named owner who can approve index changes, a place to run the extension (cloud account, data center or air-gapped network), and a decision on who holds the AGPL obligations described below.

Is built-in PostgreSQL full-text search enough for our needs?

Built-in full-text search with tsvector, GIN indexes and ts_rank often covers keyword search over one database with modest relevance needs. Consider pg_search when you need true BM25 ranking, faceted counts, aggregations over large result sets, or fast filtered search across many columns. Test both on your own data: measure query latency under realistic concurrency, check how relevance looks to your users, and count how much index maintenance each approach adds to write-heavy tables. If the built-in features meet those targets, adding an extension is extra operational surface to own.

What does the AGPL license require if we run pg_search internally?

The ParadeDB repository is licensed under AGPL-3.0. The license's network clause can matter when you modify the software and let users interact with it over a network, so the obligation depends on whether you change the code and how the service is offered. Using the unmodified extension inside your own systems is a different case from offering a modified version to outside users. Have your legal or open-source compliance team review the license text and your intended use before you commit, and record the decision with the design documents.

Can our own team run pg_search after the project ends?

Yes, if you plan for it. Your team needs skills in PostgreSQL index design, reading query plans, upgrading extensions alongside PostgreSQL major versions, and backing up and restoring the indexed data. Confirm how index rebuilds are run and how long they take on your data, how a failed upgrade is rolled back, and which dashboards and alerts show index health. DeployOpen supports handover documentation and ongoing support, and retainers are available for teams that want continued help after the initial scope closes.

What should we check in a partner's proposal before signing?

Check that the proposal lists scope, deliverables and timelines in writing, names the PostgreSQL and pg_search versions it targets, and explains how the index stays in sync with source tables. Look for a test plan that compares search results against agreed relevance examples, a rollback plan for index changes, and a handover section covering runbooks and training. Ask how security reviews of access to the search data are handled, and whether any part of the work depends on services outside your infrastructure.

How DeployOpen scopes and delivers a pg_search implementation

DeployOpen scopes a pg_search implementation as a fixed-scope engagement, with the scope, deliverables and timeline agreed in writing before any work starts. For this topic, the written scope should name the PostgreSQL major version and the ParadeDB pg_search version to be installed, the tables and columns to be indexed, the query patterns the search must serve (ranking, facets, aggregations, joins with vector filters where relevant), the expected index size and refresh behavior, and the data sensitivity classes involved. Ask for these items to appear in the statement of work so that the boundary between pg_search work, PostgreSQL work and application changes is explicit. Confirm with the ParadeDB project which pg_search releases support your PostgreSQL major version before the scope is fixed, since that pairing decides the upgrade path.

All build work happens inside your own infrastructure: your cloud accounts, data centers or air-gapped networks, on the PostgreSQL servers you already operate or plan to operate. Access is granted per environment, secrets stay in your secret store, and changes move through your change process. Before the build starts, agree who owns the AGPL-3.0 licensing review of the ParadeDB repository, who approves configuration changes to the index and to the application's query layer, and where test data comes from. Your team keeps administrative control throughout, which also means your team should expect to run the recurring index maintenance and version updates after handover.

Handover is part of the deliverable, not an afterthought. Expect written documentation covering the installed versions, the index definitions, the query examples the application uses, the backup and restore steps that include the pg_search index, the test results for relevance and performance, and a runbook for upgrades. Ask for a restore rehearsal to be included in the acceptance criteria, because an index that cannot be rebuilt from a restored database is a recovery gap. Optional retainers cover upgrades when PostgreSQL or pg_search releases change, and continuous support or retesting as the index grows. Ask for retainer terms in writing, including response expectations and which release versions they cover, and treat any retainer figure as a quote item rather than a fixed assumption.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.