biscuit
概览
| 扩展包名 | 版本 | 分类 | 许可证 | 语言 |
|---|---|---|---|---|
pg_biscuit | 2.4.3 | FTS | MIT | C |
| ID | 扩展名 | Bin | Lib | Load | Create | Trust | Reloc | 模式 |
|---|---|---|---|---|---|---|---|---|
| 2170 | biscuit | 否 | 是 | 否 | 是 | 否 | 否 | public |
| 相关扩展 | plpgsql hll rum pg_textsearch |
|---|
Latest stable PGXN distribution and package release is 2.4.3; 2.5.0 is testing; packaged control and SQL default version remain 2.4.1; package name is biscuit.
版本
| 类型 | 仓库 | 版本 | PG 大版本 | 包名 | 依赖 |
|---|---|---|---|---|---|
| EXT | PIGSTY | 2.4.3 | 1817161514 | pg_biscuit | plpgsql |
| RPM | PIGSTY | 2.4.3 | 1817161514 | biscuit_$v | - |
| DEB | PIGSTY | 2.4.3 | 1817161514 | postgresql-$v-biscuit | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 2.4.3 | PIGSTY 2.4.3 | PIGSTY 2.4.3 | N/A | N/A |
| el8.aarch64 | PIGSTY 2.4.3 | PIGSTY 2.4.3 | PIGSTY 2.4.3 | N/A | N/A |
| el9.x86_64 | N/A | N/A | |||
| el9.aarch64 | N/A | N/A | |||
| el10.x86_64 | N/A | N/A | |||
| el10.aarch64 | N/A | N/A | |||
| d12.x86_64 | PIGSTY 2.4.3 d12.x86_64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~bookworm_amd64.deb
| PIGSTY 2.4.3 d12.x86_64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~bookworm_amd64.deb
| PIGSTY 2.4.3 d12.x86_64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~bookworm_amd64.deb
| N/A | N/A |
| d12.aarch64 | PIGSTY 2.4.3 d12.aarch64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~bookworm_arm64.deb
| PIGSTY 2.4.3 d12.aarch64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~bookworm_arm64.deb
| PIGSTY 2.4.3 d12.aarch64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~bookworm_arm64.deb
| N/A | N/A |
| d13.x86_64 | PIGSTY 2.4.3 d13.x86_64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~trixie_amd64.deb
| PIGSTY 2.4.3 d13.x86_64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~trixie_amd64.deb
| PIGSTY 2.4.3 d13.x86_64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~trixie_amd64.deb
| N/A | N/A |
| d13.aarch64 | PIGSTY 2.4.3 d13.aarch64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~trixie_arm64.deb
| PIGSTY 2.4.3 d13.aarch64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~trixie_arm64.deb
| PIGSTY 2.4.3 d13.aarch64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~trixie_arm64.deb
| N/A | N/A |
| u22.x86_64 | PIGSTY 2.4.3 u22.x86_64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~jammy_amd64.deb
| PIGSTY 2.4.3 u22.x86_64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~jammy_amd64.deb
| PIGSTY 2.4.3 u22.x86_64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~jammy_amd64.deb
| N/A | N/A |
| u22.aarch64 | PIGSTY 2.4.3 u22.aarch64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~jammy_arm64.deb
| PIGSTY 2.4.3 u22.aarch64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~jammy_arm64.deb
| PIGSTY 2.4.3 u22.aarch64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~jammy_arm64.deb
| N/A | N/A |
| u24.x86_64 | PIGSTY 2.4.3 u24.x86_64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~noble_amd64.deb
| PIGSTY 2.4.3 u24.x86_64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~noble_amd64.deb
| PIGSTY 2.4.3 u24.x86_64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~noble_amd64.deb
| N/A | N/A |
| u24.aarch64 | PIGSTY 2.4.3 u24.aarch64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~noble_arm64.deb
| PIGSTY 2.4.3 u24.aarch64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~noble_arm64.deb
| PIGSTY 2.4.3 u24.aarch64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~noble_arm64.deb
| N/A | N/A |
| u26.x86_64 | PIGSTY 2.4.3 u26.x86_64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~resolute_amd64.deb
| PIGSTY 2.4.3 u26.x86_64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~resolute_amd64.deb
| PIGSTY 2.4.3 u26.x86_64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~resolute_amd64.deb
| N/A | N/A |
| u26.aarch64 | PIGSTY 2.4.3 u26.aarch64.pg18 : postgresql-18-biscuit postgresql-18-biscuit_2.4.3-1PIGSTY~resolute_arm64.deb
| PIGSTY 2.4.3 u26.aarch64.pg17 : postgresql-17-biscuit postgresql-17-biscuit_2.4.3-1PIGSTY~resolute_arm64.deb
| PIGSTY 2.4.3 u26.aarch64.pg16 : postgresql-16-biscuit postgresql-16-biscuit_2.4.3-1PIGSTY~resolute_arm64.deb
| N/A | N/A |
构建
您可以使用 pig build 命令构建 pg_biscuit 扩展的 RPM / DEB 包:
pig build pkg pg_biscuit # 构建 RPM / DEB 包
安装
您可以直接安装 pg_biscuit 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:
pig repo add pgsql -u # 添加仓库并更新缓存
使用 pig 或者是 apt/yum/dnf 安装扩展:
pig install pg_biscuit; # 当前活跃 PG 版本安装
pig ext install -y pg_biscuit -v 18 # PG 18
pig ext install -y pg_biscuit -v 17 # PG 17
pig ext install -y pg_biscuit -v 16 # PG 16
dnf install -y biscuit_18 # PG 18
dnf install -y biscuit_17 # PG 17
dnf install -y biscuit_16 # PG 16
apt install -y postgresql-18-biscuit # PG 18
apt install -y postgresql-17-biscuit # PG 17
apt install -y postgresql-16-biscuit # PG 16
创建扩展:
CREATE EXTENSION biscuit CASCADE; -- 依赖: plpgsql
用法
来源:
biscuit 是一个针对文本模式过滤优化的实验性 PostgreSQL 索引访问方法。它主要针对 LIKE, ILIKE, NOT LIKE, 和 NOT ILIKE 预测子,包括多列和表达式索引,同时以增加内存使用和写入工作为代价换取更快的过滤速度。
核心流程
CREATE EXTENSION biscuit;
CREATE INDEX message_body_biscuit_idx
ON message USING biscuit (body);
SELECT id, body
FROM message
WHERE body ILIKE '%timeout%';
当查询中使用相同的表达式时,表达式索引可以生效:
CREATE INDEX customer_email_biscuit_idx
ON customer USING biscuit (lower(email));
SELECT *
FROM customer
WHERE lower(email) LIKE '%@example.com';
对于跨越多个索引文本列的预测子,应使用多列索引,并通过在代表性数据上运行 EXPLAIN (ANALYZE, BUFFERS) 来确认选择的计划。
重要对象
biscuit是用于CREATE INDEX ... USING biscuit的索引访问方法。biscuit_operators报告支持的操作符。biscuit_version和biscuit_build_info暴露构建信息;biscuit_build_info_json以 JSON 格式返回这些信息。biscuit_status报告安装的构建和位图配置。biscuit_index_stats和biscuit_index_memory_size检查索引及其内存占用情况。biscuit_memory_usage是扩展内存使用情况视图。biscuit_has_roaring和biscuit_roaring_version报告可选的 Roaring 位图支持。
限制和操作
biscuit 主要用于过滤,而不是有序索引扫描。它不提供正则表达式或相似性搜索功能。索引可能比 B-树更大且更昂贵;在生产使用前,请先基准测试读取选择性、摄入成本、内存使用情况以及真空行为。保留常规索引以满足排序、等值、唯一性或其他访问方法的需求。
上游项目将 Biscuit 标记为积极开发中。PGXN 发布 2.4.3 作为稳定分发,但该存档的改变日志仅止于 2.4.2,其元数据和控制文件暴露 SQL 扩展版本 2.4.1。将 2.4.3 视为分发/包刷新:未声称有额外的 SQL API 变更。材料中的 2.4.2 改变修复了索引缓存中的使用后释放漏洞以及编译器警告。