跳转到主要内容

pgroonga

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

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

概览

ID扩展软件包版本类别许可证编程语言
2110pgroongapgroonga4.1.0FTSPostgreSQLC
属性可执行文件动态库需要预加载需要建扩展可迁移可信
--s-d--是是否是否否
PG15-19 packages require Groonga >=16.1.8 (Debian 12: >=16.0.5).

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY4.1.019 18 17 16 15pgroonga-
RPMPIGSTY4.1.019 18 17 16 15pgroonga_$vgroonga-libs, msgpack, xxhash-libs
DEBPIGSTY4.1.019 18 17 16 15postgresql-$v-pgroongalibgroonga0, `libmsgpackc2
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
el8.aarch64N/APIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
el9.x86_64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
el9.aarch64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
el10.x86_64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
el10.aarch64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
d12.x86_64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
d12.aarch64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
d13.x86_64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
d13.aarch64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
u22.x86_64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
u22.aarch64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
u24.x86_64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
u24.aarch64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
u26.x86_64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
u26.aarch64PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0PIGSTY 4.1.0
软件包版本平台仓库大小下载
pgroonga_194.1.0el9.x86_64pigsty248.0 KiBpgroonga_19-4.1.0-5PGSTY.el9.x86_64.rpm
pgroonga_194.1.0el9.aarch64pigsty240.0 KiBpgroonga_19-4.1.0-5PGSTY.el9.aarch64.rpm
pgroonga_194.1.0el10.x86_64pigsty250.9 KiBpgroonga_19-4.1.0-3PGSTY.el10.x86_64.rpm
pgroonga_194.1.0el10.aarch64pigsty240.8 KiBpgroonga_19-4.1.0-3PGSTY.el10.aarch64.rpm
postgresql-19-pgroonga4.1.0d12.x86_64pigsty181.5 KiBpostgresql-19-pgroonga_4.1.0-1PGSTY~bookworm_amd64.deb
postgresql-19-pgroonga4.1.0d12.aarch64pigsty163.1 KiBpostgresql-19-pgroonga_4.1.0-1PGSTY~bookworm_arm64.deb
postgresql-19-pgroonga4.1.0d13.x86_64pigsty183.2 KiBpostgresql-19-pgroonga_4.1.0-2PGSTY~trixie_amd64.deb
postgresql-19-pgroonga4.1.0d13.aarch64pigsty164.2 KiBpostgresql-19-pgroonga_4.1.0-2PGSTY~trixie_arm64.deb
postgresql-19-pgroonga4.1.0u22.x86_64pigsty198.0 KiBpostgresql-19-pgroonga_4.1.0-2PGSTY~jammy_amd64.deb
postgresql-19-pgroonga4.1.0u22.aarch64pigsty190.7 KiBpostgresql-19-pgroonga_4.1.0-2PGSTY~jammy_arm64.deb
postgresql-19-pgroonga4.1.0u24.x86_64pigsty192.1 KiBpostgresql-19-pgroonga_4.1.0-2PGSTY~noble_amd64.deb
postgresql-19-pgroonga4.1.0u24.aarch64pigsty185.7 KiBpostgresql-19-pgroonga_4.1.0-2PGSTY~noble_arm64.deb
postgresql-19-pgroonga4.1.0u26.x86_64pigsty194.1 KiBpostgresql-19-pgroonga_4.1.0-2PGSTY~resolute_amd64.deb
postgresql-19-pgroonga4.1.0u26.aarch64pigsty184.5 KiBpostgresql-19-pgroonga_4.1.0-2PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pgroonga_184.1.0el8.x86_64pigsty247.9 KiBpgroonga_18-4.1.0-3PGSTY.el8.x86_64.rpm
pgroonga_184.1.0el8.aarch64pigsty226.5 KiBpgroonga_18-4.1.0-3PGSTY.el8.aarch64.rpm
pgroonga_184.1.0el9.x86_64pigsty247.7 KiBpgroonga_18-4.1.0-5PGSTY.el9.x86_64.rpm
pgroonga_184.1.0el9.aarch64pigsty240.1 KiBpgroonga_18-4.1.0-5PGSTY.el9.aarch64.rpm
pgroonga_184.1.0el10.x86_64pigsty250.8 KiBpgroonga_18-4.1.0-3PGSTY.el10.x86_64.rpm
pgroonga_184.1.0el10.aarch64pigsty241.2 KiBpgroonga_18-4.1.0-3PGSTY.el10.aarch64.rpm
postgresql-18-pgroonga4.1.0d12.x86_64pigsty182.1 KiBpostgresql-18-pgroonga_4.1.0-1PGSTY~bookworm_amd64.deb
postgresql-18-pgroonga4.1.0d12.aarch64pigsty163.5 KiBpostgresql-18-pgroonga_4.1.0-1PGSTY~bookworm_arm64.deb
postgresql-18-pgroonga4.1.0d13.x86_64pigsty182.4 KiBpostgresql-18-pgroonga_4.1.0-2PGSTY~trixie_amd64.deb
postgresql-18-pgroonga4.1.0d13.aarch64pigsty164.0 KiBpostgresql-18-pgroonga_4.1.0-2PGSTY~trixie_arm64.deb
postgresql-18-pgroonga4.1.0u22.x86_64pigsty197.7 KiBpostgresql-18-pgroonga_4.1.0-2PGSTY~jammy_amd64.deb
postgresql-18-pgroonga4.1.0u22.aarch64pigsty190.9 KiBpostgresql-18-pgroonga_4.1.0-2PGSTY~jammy_arm64.deb
postgresql-18-pgroonga4.1.0u24.x86_64pigsty192.1 KiBpostgresql-18-pgroonga_4.1.0-2PGSTY~noble_amd64.deb
postgresql-18-pgroonga4.1.0u24.aarch64pigsty186.0 KiBpostgresql-18-pgroonga_4.1.0-2PGSTY~noble_arm64.deb
postgresql-18-pgroonga4.1.0u26.x86_64pigsty194.2 KiBpostgresql-18-pgroonga_4.1.0-2PGSTY~resolute_amd64.deb
postgresql-18-pgroonga4.1.0u26.aarch64pigsty184.5 KiBpostgresql-18-pgroonga_4.1.0-2PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pgroonga_174.1.0el8.x86_64pigsty248.0 KiBpgroonga_17-4.1.0-3PGSTY.el8.x86_64.rpm
pgroonga_174.1.0el8.aarch64pigsty226.5 KiBpgroonga_17-4.1.0-3PGSTY.el8.aarch64.rpm
pgroonga_174.1.0el9.x86_64pigsty247.8 KiBpgroonga_17-4.1.0-5PGSTY.el9.x86_64.rpm
pgroonga_174.1.0el9.aarch64pigsty239.8 KiBpgroonga_17-4.1.0-5PGSTY.el9.aarch64.rpm
pgroonga_174.1.0el10.x86_64pigsty250.9 KiBpgroonga_17-4.1.0-3PGSTY.el10.x86_64.rpm
pgroonga_174.1.0el10.aarch64pigsty241.2 KiBpgroonga_17-4.1.0-3PGSTY.el10.aarch64.rpm
postgresql-17-pgroonga4.1.0d12.x86_64pigsty181.7 KiBpostgresql-17-pgroonga_4.1.0-1PGSTY~bookworm_amd64.deb
postgresql-17-pgroonga4.1.0d12.aarch64pigsty163.8 KiBpostgresql-17-pgroonga_4.1.0-1PGSTY~bookworm_arm64.deb
postgresql-17-pgroonga4.1.0d13.x86_64pigsty182.6 KiBpostgresql-17-pgroonga_4.1.0-2PGSTY~trixie_amd64.deb
postgresql-17-pgroonga4.1.0d13.aarch64pigsty164.2 KiBpostgresql-17-pgroonga_4.1.0-2PGSTY~trixie_arm64.deb
postgresql-17-pgroonga4.1.0u22.x86_64pigsty197.5 KiBpostgresql-17-pgroonga_4.1.0-2PGSTY~jammy_amd64.deb
postgresql-17-pgroonga4.1.0u22.aarch64pigsty190.7 KiBpostgresql-17-pgroonga_4.1.0-2PGSTY~jammy_arm64.deb
postgresql-17-pgroonga4.1.0u24.x86_64pigsty191.5 KiBpostgresql-17-pgroonga_4.1.0-2PGSTY~noble_amd64.deb
postgresql-17-pgroonga4.1.0u24.aarch64pigsty185.9 KiBpostgresql-17-pgroonga_4.1.0-2PGSTY~noble_arm64.deb
postgresql-17-pgroonga4.1.0u26.x86_64pigsty194.0 KiBpostgresql-17-pgroonga_4.1.0-2PGSTY~resolute_amd64.deb
postgresql-17-pgroonga4.1.0u26.aarch64pigsty184.5 KiBpostgresql-17-pgroonga_4.1.0-2PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pgroonga_164.1.0el8.x86_64pigsty245.8 KiBpgroonga_16-4.1.0-3PGSTY.el8.x86_64.rpm
pgroonga_164.1.0el8.aarch64pigsty224.7 KiBpgroonga_16-4.1.0-3PGSTY.el8.aarch64.rpm
pgroonga_164.1.0el9.x86_64pigsty245.7 KiBpgroonga_16-4.1.0-5PGSTY.el9.x86_64.rpm
pgroonga_164.1.0el9.aarch64pigsty238.0 KiBpgroonga_16-4.1.0-5PGSTY.el9.aarch64.rpm
pgroonga_164.1.0el10.x86_64pigsty248.4 KiBpgroonga_16-4.1.0-3PGSTY.el10.x86_64.rpm
pgroonga_164.1.0el10.aarch64pigsty239.3 KiBpgroonga_16-4.1.0-3PGSTY.el10.aarch64.rpm
postgresql-16-pgroonga4.1.0d12.x86_64pigsty179.4 KiBpostgresql-16-pgroonga_4.1.0-1PGSTY~bookworm_amd64.deb
postgresql-16-pgroonga4.1.0d12.aarch64pigsty161.6 KiBpostgresql-16-pgroonga_4.1.0-1PGSTY~bookworm_arm64.deb
postgresql-16-pgroonga4.1.0d13.x86_64pigsty180.3 KiBpostgresql-16-pgroonga_4.1.0-2PGSTY~trixie_amd64.deb
postgresql-16-pgroonga4.1.0d13.aarch64pigsty162.9 KiBpostgresql-16-pgroonga_4.1.0-2PGSTY~trixie_arm64.deb
postgresql-16-pgroonga4.1.0u22.x86_64pigsty195.4 KiBpostgresql-16-pgroonga_4.1.0-2PGSTY~jammy_amd64.deb
postgresql-16-pgroonga4.1.0u22.aarch64pigsty188.6 KiBpostgresql-16-pgroonga_4.1.0-2PGSTY~jammy_arm64.deb
postgresql-16-pgroonga4.1.0u24.x86_64pigsty190.0 KiBpostgresql-16-pgroonga_4.1.0-2PGSTY~noble_amd64.deb
postgresql-16-pgroonga4.1.0u24.aarch64pigsty183.9 KiBpostgresql-16-pgroonga_4.1.0-2PGSTY~noble_arm64.deb
postgresql-16-pgroonga4.1.0u26.x86_64pigsty191.6 KiBpostgresql-16-pgroonga_4.1.0-2PGSTY~resolute_amd64.deb
postgresql-16-pgroonga4.1.0u26.aarch64pigsty182.4 KiBpostgresql-16-pgroonga_4.1.0-2PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pgroonga_154.1.0el8.x86_64pigsty245.8 KiBpgroonga_15-4.1.0-3PGSTY.el8.x86_64.rpm
pgroonga_154.1.0el8.aarch64pigsty224.5 KiBpgroonga_15-4.1.0-3PGSTY.el8.aarch64.rpm
pgroonga_154.1.0el9.x86_64pigsty244.9 KiBpgroonga_15-4.1.0-5PGSTY.el9.x86_64.rpm
pgroonga_154.1.0el9.aarch64pigsty237.5 KiBpgroonga_15-4.1.0-5PGSTY.el9.aarch64.rpm
pgroonga_154.1.0el10.x86_64pigsty248.2 KiBpgroonga_15-4.1.0-3PGSTY.el10.x86_64.rpm
pgroonga_154.1.0el10.aarch64pigsty238.5 KiBpgroonga_15-4.1.0-3PGSTY.el10.aarch64.rpm
postgresql-15-pgroonga4.1.0d12.x86_64pigsty179.0 KiBpostgresql-15-pgroonga_4.1.0-1PGSTY~bookworm_amd64.deb
postgresql-15-pgroonga4.1.0d12.aarch64pigsty161.1 KiBpostgresql-15-pgroonga_4.1.0-1PGSTY~bookworm_arm64.deb
postgresql-15-pgroonga4.1.0d13.x86_64pigsty180.6 KiBpostgresql-15-pgroonga_4.1.0-2PGSTY~trixie_amd64.deb
postgresql-15-pgroonga4.1.0d13.aarch64pigsty162.5 KiBpostgresql-15-pgroonga_4.1.0-2PGSTY~trixie_arm64.deb
postgresql-15-pgroonga4.1.0u22.x86_64pigsty194.8 KiBpostgresql-15-pgroonga_4.1.0-2PGSTY~jammy_amd64.deb
postgresql-15-pgroonga4.1.0u22.aarch64pigsty187.9 KiBpostgresql-15-pgroonga_4.1.0-2PGSTY~jammy_arm64.deb
postgresql-15-pgroonga4.1.0u24.x86_64pigsty189.5 KiBpostgresql-15-pgroonga_4.1.0-2PGSTY~noble_amd64.deb
postgresql-15-pgroonga4.1.0u24.aarch64pigsty183.1 KiBpostgresql-15-pgroonga_4.1.0-2PGSTY~noble_arm64.deb
postgresql-15-pgroonga4.1.0u26.x86_64pigsty191.4 KiBpostgresql-15-pgroonga_4.1.0-2PGSTY~resolute_amd64.deb
postgresql-15-pgroonga4.1.0u26.aarch64pigsty182.3 KiBpostgresql-15-pgroonga_4.1.0-2PGSTY~resolute_arm64.deb

源码

pig build pkg pgroonga;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install pgroonga;		# install by package name

pig install pgroonga -v 19;   # install for PG 19
pig install pgroonga -v 18;   # install for PG 18
pig install pgroonga -v 17;   # install for PG 17
pig install pgroonga -v 16;   # install for PG 16
pig install pgroonga -v 15;   # install for PG 15

在数据库中创建扩展。

CREATE EXTENSION pgroonga;

用法

来源:

pgroonga 4.1.0 使用 Groonga 索引实现多语言全文检索,安装 pgroonga 访问方法及 SQL 操作符,普通使用不需要共享预加载。

核心流程

安装兼容的 PGroonga 与 Groonga 库后,由管理员创建扩展:

CREATE EXTENSION pgroonga;
CREATE TABLE search_notes (id bigint PRIMARY KEY, body text);
CREATE INDEX search_notes_body_idx ON search_notes USING pgroonga (body);
INSERT INTO search_notes VALUES (1, 'PostgreSQL supports full text search');
SELECT id, body FROM search_notes WHERE body &@ 'PostgreSQL';
SELECT id, body, pgroonga_score(tableoid, ctid) AS score
FROM search_notes WHERE body &@~ 'PostgreSQL OR Groonga'
ORDER BY score DESC;

主要对象

  • &@ 匹配关键词;&@~ 接受 Groonga 查询语法。受支持的 LIKE/ILIKE 查询也可使用索引,并在需要时复查结果。
  • pgroonga_score(tableoid, ctid) 取得搜索得分;按得分排序时,应确认实际执行了预期索引计划。
  • pgroonga_highlight_html() 与 pgroonga_query_extract_keywords() 生成高亮结果;pgroonga_snippet_html() 提供关键词附近的文本。
  • 4.0.9 新增 pgroonga_physical_table_names(partitioned_index, prefix),以文本数组返回 Groonga 命令参数,标识各分区索引背后的物理表。该版本也开始为 PGroonga 扫描累加 pg_stat_user_indexes.idx_scan。

维护与权限

4.1.0 控制文件未声明受信任安装或可迁移模式,不应假定普通用户能安装扩展或将其移到其他模式。索引创建和查询仍需相应的表权限。应使扩展及 Groonga 库与目标 PostgreSQL 构建匹配,并在替换二进制前遵循上游升级说明。

PGroonga 除表数据外还管理派生索引文件,应据此规划磁盘容量和备份恢复流程。适用时使用 REINDEX 修复索引。独立的 pgroonga_database 模块用于恢复损坏的内部 Groonga 数据库,正常搜索并不需要它。在生产环境中,不要为了强制使用索引而全局关闭顺序扫描。

Pigsty 运行库兼容性

当前 Pigsty EL8 和 EL9 软件包与 PostGIS Raster 存在已确认的共存限制,影响 x86_64、aarch64 两种架构及 PostgreSQL 14–18。Groonga 使用 Arrow 22,本轮 GDAL/Raster 依赖栈则在 EL8 使用 Arrow 8、在 EL9 使用 Arrow 9。将两套依赖加载到同一个 PostgreSQL 后端可能导致崩溃;SQL 查询成功并不能证明后端正常退出。

改变加载顺序不是完整修复:EL9 aarch64 的自动会话预加载仍出现后端退出崩溃。在验证兼容依赖组合前,应避免在同一个后端启用两套依赖,必要时隔离使用。本轮测试的 EL10 和 Debian/Ubuntu 组合未复现该故障,但不能据此推广到任意其他依赖版本。这是 Pigsty 软件包依赖栈的边界,不是上游要求普通 PGroonga 搜索必须预加载。

MeCab 分词还需要匹配的 Groonga 分词插件和词典。仅安装 PostgreSQL 扩展并不会提供全部可选分词器;在建立指定分词器的索引前,应确认它可用。

4.1.0 版本

4.1.0 修复其他会话在 CREATE INDEX 提交前执行 VACUUM/ANALYZE 导致索引数据被移除的问题,已经受影响的索引可能需要 REINDEX。直接调用 Groonga 时,搭配 Groonga 16.1.5 或更新版本可在 post_filter 中使用 pgroonga_tuple_is_alive。这次源码发布不改变另行记录的 Pigsty 依赖栈限制。

表格阅读器