pgroonga

使用Groonga,面向所有语言的高速全文检索平台

概览

扩展包名版本分类许可证语言
pgroonga4.0.4FTSPostgreSQLC
ID扩展名BinLibLoadCreateTrustReloc模式
2110pgroonga-
2111pgroonga_database-
相关扩展pg_search pg_bigm zhparser pg_bestmatch pg_tokenizer pg_trgm rum vchord_bm25

require xxHash vendor repo to build

版本

类型仓库版本PG 大版本包名依赖
EXTPIGSTY4.0.41817161514pgroonga-
RPMPIGSTY4.0.41817161514pgroonga_$vgroonga-libs
DEBPIGSTY4.0.41817161514postgresql-$v-pgroongalibgroonga0
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
el8.aarch64
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
el9.x86_64
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
el9.aarch64
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
el10.x86_64
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
el10.aarch64
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
d12.x86_64
d12.aarch64
d13.x86_64
d13.aarch64
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
u22.x86_64
u22.aarch64
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
u24.x86_64
u24.aarch64
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4
PIGSTY 4.0.4

构建

您可以使用 pig build 命令构建 pgroonga 扩展的 RPM / DEB 包:

pig build pkg pgroonga         # 构建 RPM / DEB 包

安装

您可以直接安装 pgroonga 扩展包的预置二进制包,首先确保 PGDGPIGSTY 仓库已经添加并启用:

pig repo add pgsql -u          # 添加仓库并更新缓存

使用 pig 或者是 apt/yum/dnf 安装扩展:

pig install pgroonga;          # 当前活跃 PG 版本安装
pig ext install -y pgroonga -v 18  # PG 18
pig ext install -y pgroonga -v 17  # PG 17
pig ext install -y pgroonga -v 16  # PG 16
pig ext install -y pgroonga -v 15  # PG 15
pig ext install -y pgroonga -v 14  # PG 14
dnf install -y pgroonga_18       # PG 18
dnf install -y pgroonga_17       # PG 17
dnf install -y pgroonga_16       # PG 16
dnf install -y pgroonga_15       # PG 15
dnf install -y pgroonga_14       # PG 14
apt install -y postgresql-18-pgroonga   # PG 18
apt install -y postgresql-17-pgroonga   # PG 17
apt install -y postgresql-16-pgroonga   # PG 16
apt install -y postgresql-15-pgroonga   # PG 15
apt install -y postgresql-14-pgroonga   # PG 14

创建扩展

CREATE EXTENSION pgroonga;

用法

以下是一个关于如何使用 PGroonga 的快速教程

CREATE EXTENSION IF NOT EXISTS pgroonga;

CREATE TABLE memos
(
    id      integer,
    content text
);

CREATE INDEX pgroonga_content_index ON memos USING pgroonga (content);

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.');

SET enable_seqscan = off;

-- 现在让我们使用 pgroonga 进行查询

SELECT * FROM memos WHERE content &@ 'engine';
--  id |                                content
-- ----+------------------------------------------------------------------------
--   2 | Groonga is a fast full text search engine that supports all languages.
-- (1 row)

SELECT * FROM memos WHERE content &@~ 'PGroonga OR PostgreSQL';
--  id |                            content
-- ----+----------------------------------------------------------------
--   3 | PGroonga is a PostgreSQL extension that uses Groonga as index.
--   1 | PostgreSQL is a relational database management system.
-- (2 rows)

SELECT * FROM memos WHERE content LIKE '%engine%';
--  id |                                content
-- ----+------------------------------------------------------------------------
--   2 | Groonga is a fast full text search engine that supports all languages.
-- (1 row)

最后修改 2026-03-08: add extension catalog (baacba6)