This guide explains how to install the pg_search extension inside an existing PostgreSQL database. These instructions are for deploying on Linux Debian/Ubuntu. If you are using a different version of Linux, please contact us.

Prerequisites

First, ensure that you have superuser access to the Postgres database.

Next, install libicu.

sudo apt-get install -y libicu70

Install pg_search

ParadeDB provides prebuilt binaries for the pg_search extension for Postgres 14, 15 and 16 on Ubuntu 22.04. They can be found in GitHub Releases. If you are using a different version of Postgres or a different operating system, you will need to build the extension from source.

Using Prebuilt Binaries

curl -L "https://github.com/paradedb/paradedb/releases/download/v0.7.0/pg_search-v0.7.0-pg16-arm64-ubuntu2204.deb" -o /tmp/pg_search.deb
sudo apt-get install -y /tmp/*.deb

Note: You can replace v0.7.0 with the pg_search version you wish to install, and pg16 with the version of Postgres you are using.

Building from Source

Please follow these instructions.

Update postgresql.conf

Next, add pg_search to shared_preload_libraries in postgresql.conf.

shared_preload_libraries = 'pg_search'

Reload your PostgreSQL server for these changes to take effect.

Load the Extension

Once the extension binary is installed on your system, connect to your Postgres database via your client of choice (e.g. psql) and run the following command:

CREATE EXTENSION pg_search;

That’s it! You’re all set to use pg_search in your database. To get started, we suggest you follow the quickstart guide.

pg_search can be combined with pgvector for hybrid search. You can find the instructions for installing pgvector here.