---
title: "Deploy PGroonga"
description: "Enable super-fast, multilingual full-text search within PostgreSQL."
category: "Storage"
url: https://railway.com/deploy/pgroonga
---

# Deploy PGroonga

Enable super-fast, multilingual full-text search within PostgreSQL.

**[Deploy PGroonga on Railway](https://railway.com/template/pgroonga)**

- **Creator:** PGroonga
- **Category:** Storage
- **Total deploys:** 12
- **Verified:** Yes

## Template content

### PGroonga https://groonga.org/images/logos/pgroonga-icon-foreground-white.svg

- **Image:** groonga/pgroonga:latest-debian-18
- **Start command:** `/bin/sh -c "unset PGPORT; docker-entrypoint.sh postgres --port=5432"`

## Documentation

# Deploy and Host PGroonga on Railway

Enable super-fast, multilingual full-text search within PostgreSQL.

## About Hosting PGroonga

PGroonga is a PostgreSQL extension that adds advanced full-text search capabilities for all languages.
Unlike PostgreSQL’s built-in full-text search, which mainly supports alphabets and digits, PGroonga can index and query text in languages such as Japanese or Chinese - all with zero ETL.

Also, PGroonga can instantly search newly inserted or updated data without reindexing or read locks, making it ideal for real-time workloads.
Since it runs entirely inside PostgreSQL, it maintains ACID compliance, replication, and transaction safety.

Railway’s scalable infrastructure makes it easy to deploy PGroonga with automatic scaling, persistent storage, and one-click setup.

### Demo Project: Redmine + PGroonga Full-Text Search

To demonstrate how this template can be used in a real-world application, we provide a demo project that integrates **Redmine** with the **Redmine Full Text Search plugin**, powered by **PGroonga**, on Railway.

This demo shows how to enable multilingual full-text search in Redmine using PGroonga without introducing any external search services.

Demo repository:  
https://github.com/pgroonga/redmine-full-text-search-railway-sample

## Common Use Cases

- **Multilingual Search Applications**: Powering e-commerce sites, content platforms, and documentation systems that need instant, language-agnostic full-text search within PostgreSQL.
- **Real-Time Search Applications**: Delivering low-latency search results on frequently updated data, such as chat logs, knowledge bases, or user-generated content, with immediate index updates and no read locks.
- **Integrated Search Infrastructure**: Running directly inside PostgreSQL, PGroonga eliminates the need for separate search services. Teams can leverage their existing PostgreSQL operations and monitoring workflows, reducing maintenance overhead and simplifying infrastructure while gaining powerful full-text search capabilities.

## Dependencies for PGroonga Hosting

None.

PGroonga is a self-contained PostgreSQL extension that integrates directly with the database engine.
It requires no external services or dependencies and leverages PostgreSQL's built-in functionality to deliver high-performance, real-time full-text search across all languages.

### Deployment Dependencies

- [Official PGroonga Docker image](https://hub.docker.com/r/groonga/pgroonga)
- [PGroonga repository](https://github.com/pgroonga/pgroonga)
- PostgreSQL 18

## Implementation Details

### Setup Configuration

This template provides PostgreSQL with the PGroonga extension pre-installed.
A TCP proxy is configured to allow access to the database from anywhere, enabling external connections to the PGroonga database.

Please configure the following environment variables according to your environment:

- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB

### Database Connection

Use the DATABASE_URL variable from your Railway service to connect to the PGroonga database.

```console
$ psql $DATABASE_URL
```

Or, if you want to reference it from another Railway service's variable, you can use it as the [reference variables](https://docs.railway.com/guides/variables#referencing-another-services-variable-example):

```
${{PGroonga.DATABASE_URL}}
```

### How To Use

Once connected, enable the PGroonga extension using the following SQL:

```sql
CREATE EXTENSION pgroonga;
```

#### Create a full-text search index

Create a column that you want to enable full-text search on, using the `text` type.

```sql
CREATE TABLE memos (
  id integer,
  content text
);
```

Create a PGroonga index on the target column.

```sql
CREATE INDEX pgroonga_content_index ON memos USING pgroonga (content);
```

(Optional) Insert some sample data.

```sql
INSERT INTO memos VALUES (1, 'PostgreSQL is a relational database management system.');
INSERT INTO memos VALUES (2, 'Groonga is a fast full-text search engine that supports all languages.');
INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga as index.');
INSERT INTO memos VALUES (4, 'There is groonga command.');
```

Now your setup is complete!
You can start running full-text searches instantly.

### Full text search

You can use `&amp;@~` operator to perform full-text search:

```sql
SELECT * FROM memos WHERE content &amp;@~ 'Groonga';
```

Result:

```
 id |                                content                                 
----+------------------------------------------------------------------------
  2 | Groonga is a fast full-text search engine that supports all languages.
  3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
  4 | There is groonga command.
(3 rows)
```

##### Match all search words

Use spaces between words for **AND** search:

```sql
SELECT * FROM memos WHERE content &amp;@~ 'Groonga PostgreSQL';
```

Result:

```
 id |                            content                             
----+----------------------------------------------------------------
  3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
(1 row)
```

##### Match any search words

Use OR between words for **OR** search:

```sql
SELECT * FROM memos WHERE content &amp;@~ 'PostgreSQL OR engine' ORDER BY id;
```

Result:

```
 id |                                content                                 
----+------------------------------------------------------------------------
  1 | PostgreSQL is a relational database management system.
  2 | Groonga is a fast full-text search engine that supports all languages.
  3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
(3 rows)
```

### Score

You can use the `pgroonga_score` function to get a relevance score for each record.
Higher scores indicate stronger matches with the query terms.

```sql
SELECT *, pgroonga_score(tableoid, ctid) AS score
  FROM memos
 WHERE content &amp;@~ 'PostgreSQL OR PGroonga'
 ORDER BY score DESC;
```

Result:

```
 id |                            content                             | score 
----+----------------------------------------------------------------+-------
  3 | PGroonga is a PostgreSQL extension that uses Groonga as index. |     2
  1 | PostgreSQL is a relational database management system.         |     1
(2 rows)
```

PGroonga provides many more features such as prefix search, highlighting, and JSON field search.
See the official documentation for more information.

## Resources

- [PGroonga documentation](https://pgroonga.github.io/)

## Why Deploy PGroonga on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying PGroonga on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/pgroonga
