diff --git a/CN/modules/ROOT/images/p31.png b/CN/modules/ROOT/images/p31.png new file mode 100644 index 00000000..51e0e02a Binary files /dev/null and b/CN/modules/ROOT/images/p31.png differ diff --git a/CN/modules/ROOT/images/p32.png b/CN/modules/ROOT/images/p32.png new file mode 100644 index 00000000..d8cc211d Binary files /dev/null and b/CN/modules/ROOT/images/p32.png differ diff --git a/CN/modules/ROOT/nav.adoc b/CN/modules/ROOT/nav.adoc index 85dbd1c8..13890a93 100644 --- a/CN/modules/ROOT/nav.adoc +++ b/CN/modules/ROOT/nav.adoc @@ -10,8 +10,15 @@ ** xref:v1.17/7.adoc[开发者指南] ** xref:v1.17/8.adoc[运维管理指南] * IvorySQL生态 +** xref:v1.17/33.adoc[概述] ** xref:v1.17/9.adoc[PostGIS] ** xref:v1.17/10.adoc[pgvector] +** xref:v1.17/34.adoc[PGroonga] +** xref:v1.17/35.adoc[pgddl (DDL Extractor)] +** xref:v1.17/36.adoc[pgRouting] +** xref:v1.17/37.adoc[pg_cron] +** xref:v1.17/38.adoc[pgsql-http] +** xref:v1.17/40.adoc[pgvectorscale] * Oracle兼容功能列表 ** xref:v1.17/11.adoc[1、Ivorysql框架设计] ** xref:v1.17/12.adoc[2、GUC框架] @@ -24,4 +31,4 @@ ** xref:v1.17/19.adoc[9、新增Oracle兼容模式的端口与IP] * xref:v1.17/20.adoc[社区贡献指南] * xref:v1.17/21.adoc[工具参考] -* xref:v1.17/22.adoc[FAQ] \ No newline at end of file +* xref:v1.17/22.adoc[FAQ] diff --git a/CN/modules/ROOT/pages/v1.17/10.adoc b/CN/modules/ROOT/pages/v1.17/10.adoc index 1a88cffd..8d10d419 100644 --- a/CN/modules/ROOT/pages/v1.17/10.adoc +++ b/CN/modules/ROOT/pages/v1.17/10.adoc @@ -31,7 +31,7 @@ export PG_CONFIG=/usr/local/ivorysql/ivorysql-1.17/bin/pg_config ** 拉取pg_vector源码 ``` -git clone --branch v0.6.2 https://github.com/pgvector/pgvector.git +git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git ``` ** 安装 pgvector diff --git a/CN/modules/ROOT/pages/v1.17/33.adoc b/CN/modules/ROOT/pages/v1.17/33.adoc new file mode 100644 index 00000000..194587e2 --- /dev/null +++ b/CN/modules/ROOT/pages/v1.17/33.adoc @@ -0,0 +1,27 @@ +:sectnums: +:sectnumlevels: 5 + + +[discrete] +== IvorySQL生态插件适配列表 + +IvorySQL 作为一款兼容 Oracle 且基于 PostgreSQL 的高级开源数据库,具备强大的扩展能力,支持丰富的生态系统插件。这些插件可以帮助用户在不同场景下增强数据库功能,包括地理信息处理、向量检索、全文搜索、数据定义提取和路径规划等。以下是当前 IvorySQL 官方兼容和支持的主要插件列表: + ++ + +[cols="2,1,3,3"] +|==== +|*插件名称*|*版本*|*功能描述*|*适用场景* +| xref:v1.17/9.adoc[PostGIS] | 3.4.0 | 为 IvorySQL 提供地理空间数据支持,包括空间索引、空间函数和地理对象存储 | 地理信息系统(GIS)、地图服务、位置数据分析 +| xref:v1.17/10.adoc[pgvector] | 0.8.0 | 支持向量相似性搜索,可用于存储和检索高维向量数据| AI 应用、图像检索、推荐系统、语义搜索 +| xref:v1.17/34.adoc[PGroonga] | 4.0.1 | 提供多语言全文搜索功能,支持超高速文本检索和模糊匹配 | 日志分析、多语言内容搜索、实时搜索引擎 +| xref:v1.17/35.adoc[pgddl (DDL Extractor)] | 0.20 | 提取数据库中的 DDL(数据定义语言)语句,便于版本管理和迁移 | 数据库版本控制、CI/CD 集成、结构比对与同步 +| xref:v1.17/36.adoc[pgRouting] | 3.5.1 | 基于地理数据的路径规划扩展,支持最短路径、旅行商问题等算法 | 物流规划、交通网络分析、路径优化服务 +| xref:v1.17/37.adoc[pg_cron]​ | 1.6.0 | 提供数据库内部的定时任务调度功能,支持定期执行SQL语句 | 数据清理、定期统计、自动化维护任务 +| xref:v1.17/38.adoc[pgsql-http]​ | 1.7.0 | 允许在SQL中发起HTTP请求,与外部Web服务进行交互 | 数据采集、API集成、微服务调用 +| xref:v1.17/40.adoc[pgvectorscale] | 0.8.0 | 提供向量数据的分片和分布式扩展支持,提升大规模向量处理性能 | 分布式向量数据库、高并发向量查询 +|==== + +这些插件均经过 IvorySQL 团队的测试和适配,确保在 IvorySQL 环境下稳定运行。用户可以根据业务需求选择合适的插件,进一步提升数据库系统的能力和灵活性。 + +我们也将持续扩展和丰富 IvorySQL 的插件生态,欢迎社区开发者提交新的插件适配建议或代码贡献。如需了解更多每个插件的详细使用方法和最新兼容版本,请参阅各插件对应的文档章节。 \ No newline at end of file diff --git a/CN/modules/ROOT/pages/v1.17/34.adoc b/CN/modules/ROOT/pages/v1.17/34.adoc new file mode 100644 index 00000000..41429026 --- /dev/null +++ b/CN/modules/ROOT/pages/v1.17/34.adoc @@ -0,0 +1,111 @@ + +:sectnums: +:sectnumlevels: 5 + += PGroonga + +== 概述 +PostgreSQL 内置了全文搜索功能,但在处理​​大规模数据​​、​​复杂查询​​以及​​非英语语言(特别是中日韩等 CJK 语言)​​ 时,其功能和性能可能无法满足高性能应用的需求。 + +PGroonga 应运而生,它是一个 PostgreSQL 的扩展插件,将 ​​Groonga​​ 这款高性能的全功能全文搜索引擎与 PostgreSQL 数据库深度融合。Groonga 本身是一个优秀的开源搜索引擎,以其极致的速度和丰富的功能著称,尤其擅长处理多语言文本。PGroonga 的使命就是将 Groonga 的强大能力无缝地带入 PostgreSQL 的世界,为用户提供远超原生全文搜索的体验。 + +== 安装 +根据开发环境,用户可从 https://pgroonga.github.io/install[PGroonga安装] 页面选择适合自己的方式进行PGroonga安装。 +IvorySQL的安装包里已经集成了PGroonga插件,如果使用安装包安装的IvorySQL,通常不需要再手动安装PGroonga即可使用。 + +=== 源码安装 +除PGroonga社区提供的安装方式以外,IvorySQL社区也提供了源码安装方式,源码安装环境为 Ubuntu 24.04(x86_64)。 + +[TIP] +环境中已经安装了IvorySQL1.17及以上版本,安装路径为/usr/local/ivorysql/ivorysql-1 + +==== 安装 groonga + +** 安装依赖 kytea +[literal] +---- +git clone https://github.com/neubig/kytea.git +autoreconf -i +./configure +make +sudo make install +---- + +** 安装依赖 libzmq +[literal] +---- +从https://github.com/zeromq/libzmq/releases/tag/v4.3.5 下载zeromq-4.3.5.tar.gz +tar xvf zeromq-4.3.5.tar.gz +cd zeromq-4.3.5/ +./configure +make +sudo make install +---- + +** 下载 groonga包,安装指定依赖 +[literal] +---- +wget https://packages.groonga.org/source/groonga/groonga-latest.tar.gz +tar xvf groonga-15.1.5.tar.gz +cd groonga-15.1.5 +#运行这个脚本安装依赖,支持apt和dnf包管理工具 +./ setup.sh +---- + +** 编译安装 +[literal] +---- +# -S 指定groonga源码目录, -B 指定build目录,这个目录是个源码目录之外的一个只用于build的目录 +cmake -S /home/ivorysql/groonga-15.1.5 -B /home/ivorysql/groonga_build --preset=release-maximum +cmake --build /home/ivorysql/groonga_build +sudo cmake --install /home/ivorysql/groonga_build +# 更新动态链接库缓存 +sudo ldconfig +---- + +** 验证 groonga安装成功 +[literal] +---- +$ groonga --version +Groonga 15.1.5 [Linux,x86_64,utf8,match-escalation-threshold=0,nfkc,mecab,message-pack,mruby,onigmo,zlib,lz4,zstandard,epoll,apache-arrow,xxhash,blosc,bfloat16,h3,simdjson,llama.cpp] +---- + +==== 安装 pgroonga +[literal] +---- +wget https://packages.groonga.org/source/pgroonga/pgroonga-4.0.1.tar.gz +tar xvf pgroonga-4.0.1.tar.gz +cd pgroonga-4.0.1 +---- + +编译PGroonga,有个选项:HAVE_MSGPACK=1,它是用于支持WAL,使用这个选项需要安装msgpack-c 1.4.1或者更高版本。在基于Debian的平台使用libmsgpack-dev包,在CentOS 7上用msgpack-devel +[literal] +---- +#安装依赖 +sudo apt install libmsgpack-dev +---- + +运行make前确保pg_config命令的路径在PATH环境变量里 +[literal] +---- +make HAVE_MSGPACK=1 +make install +---- + +== 创建Extension并确认PGroonga版本 + +psql 连接到数据库,执行如下命令: +[literal] +---- +ivorysql=# CREATE extension pgroonga; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'pgroonga'; + name | default_version | installed_version | comment +---------+-----------------+-------------------+------------------------------------------------------------------------------- + pgroonga| 4.0.1 | 4.0.1 | Super fast and all languages supported full text search index based on Groonga +(1 row) +---- + +== 使用 +关于PGroonga的使用,请参阅 https://pgroonga.github.io/tutorial[PGroonga官方文档] \ No newline at end of file diff --git a/CN/modules/ROOT/pages/v1.17/35.adoc b/CN/modules/ROOT/pages/v1.17/35.adoc new file mode 100644 index 00000000..f0131ab3 --- /dev/null +++ b/CN/modules/ROOT/pages/v1.17/35.adoc @@ -0,0 +1,47 @@ + +:sectnums: +:sectnumlevels: 5 + += pgddl (DDL Extractor) + +== 概述 +pgddl 是一个专为 PostgreSQL 数据库设计的 SQL 函数扩展,它能够直接从数据库系统目录中生成清晰、格式化的 SQL DDL (数据定义语言) 脚本,例如 CREATE TABLE 或 ALTER FUNCTION。它解决了 PostgreSQL 原生缺乏类似 SHOW CREATE TABLE 命令的问题,让用户无需借助外部工具(如 pg_dump)即可在纯 SQL 环境中轻松获取对象的创建语句。 + +该扩展通过一组简单的 SQL 函数提供了一套完整的解决方案,其优势包括:仅需使用 SQL 查询即可操作、支持通过 WHERE 子句灵活筛选对象、并能智能处理对象之间的依赖关系,生成包含 Drop 和 Create 步骤的完整脚本。这使得它特别适用于数据库变更管理、升级脚本编写和结构审计等场景。 + +需要注意的是,ddlx 仍在发展中,可能尚未覆盖所有 PostgreSQL 对象类型和高级选项。生成的脚本建议始终在非生产环境中先行检查和测试,以确保其正确性与安全性。 + +== 安装 +IvorySQL的安装包里已经集成了pgddl插件,如果使用安装包安装的IvorySQL,通常不需要再手动安装pgddl即可使用。其它安装方式可以参考下面的源码安装步骤。 + +[TIP] +源码安装环境为 Ubuntu 24.04(x86_64),环境中已经安装了IvorySQL1.17及以上版本,安装路径为/usr/local/ivorysql/ivorysql-1 + +=== 源码安装 +从https://github.com/lacanoid/pgddl/releases/tag/0.20 下载pgddl-0.20.tar.gz,解压缩。 + +[literal] +---- +cd pgddl-0.20 +# 设置PG_CONFIG环境变量值为pg_config路径,eg:/usr/local/ivorysql/ivorysql-1/bin/pg_config +make PG_CONFIG=/path/to/pg_config +make PG_CONFIG=/path/to/pg_config install +---- + +== 创建Extension并确认ddlx版本 + +psql 连接到数据库,执行如下命令: +[literal] +---- +ivorysql=# CREATE extension ddlx; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'ddlx'; + name | default_version | installed_version | comment +------+-----------------+-------------------+------------------------- + ddlx | 0.20 | 0.20 | DDL eXtractor functions +(1 row) +---- + +== 使用 +关于pgddl的使用,请参阅 https://github.com/lacanoid/pgddl[ddlx官方文档] \ No newline at end of file diff --git a/CN/modules/ROOT/pages/v1.17/36.adoc b/CN/modules/ROOT/pages/v1.17/36.adoc new file mode 100644 index 00000000..295f5100 --- /dev/null +++ b/CN/modules/ROOT/pages/v1.17/36.adoc @@ -0,0 +1,61 @@ + +:sectnums: +:sectnumlevels: 5 + += pgRouting + +== 概述 +pgRouting 是一个基于 PostgreSQL/PostGIS 数据库构建的开源地理空间路由扩展库。它为数据库赋予了强大的网络分析功能,使其能够处理复杂的路径规划与图论计算问题,例如计算两点之间的最短路径、执行旅行推销员(TSP)分析或计算服务区范围等。它将路由算法直接嵌入到数据库中,从而避免了在应用层进行复杂的数据传输与计算。 + +该扩展的核心优势在于能够利用 PostgreSQL 强大的数据管理能力和 PostGIS 丰富的空间函数,直接在数据库内部对空间网络数据执行高效计算。这不仅简化了应用程序的开发流程,还通过减少数据移动大幅提升了大规模网络分析的性能。 + +pgRouting 广泛应用于物流配送、交通导航、网络分析、城市规划及供应链管理等多个领域。其开源特性吸引了全球开发者持续的贡献与完善,使其成为空间数据库领域进行路径分析和网络求解的首选工具之一。 + +== 安装 +IvorySQL的安装包里已经集成了pgRouting插件,如果使用安装包安装的IvorySQL,通常不需要再手动安装pgRouting即可使用。其它安装方式可以参考下面的源码安装步骤。 + +[TIP] +源码安装环境为 Ubuntu 24.04(x86_64),环境中已经安装了IvorySQL1.17及以上版本,安装路径为/usr/local/ivorysql/ivorysql-1 + +=== 源码安装 + +** 安装依赖 + +对perl有依赖,perl一般在装IvorySQL时已经装上了,这里不用再装。 +CMake版本要求 >= 3.12, Boost版本 >= 1.56 +[literal] +---- +#安装依赖 +sudo apt install cmake libboost-all-dev +---- + +** 编译安装 +[literal] +---- +wget https://github.com/pgRouting/pgrouting/releases/download/v3.5.1/pgrouting-3.5.1.tar.gz +tar xvf pgrouting-3.5.1.tar.gz +cd pgrouting-3.5.1 +mkdir build +cd build +cmake .. -DPOSTGRESQL_PG_CONFIG=/path/to/pg_config # eg: /usr/local/ivorysql/ivorysql-1/bin/pg_config +make +sudo make install +---- + +== 创建Extension并确认ddlx版本 + +psql 连接到数据库,执行如下命令: +[literal] +---- +ivorysql=# CREATE extension pgrouting; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'pgrouting'; + name | default_version | installed_version | comment +-----------+-----------------+-------------------+--------------------- + pgrouting | 3.5.1 | | pgRouting Extension +(1 row) +---- + +== 使用 +关于pgRouting的使用,请参阅 https://docs.pgrouting.org/[pgRouting官方文档] \ No newline at end of file diff --git a/CN/modules/ROOT/pages/v1.17/37.adoc b/CN/modules/ROOT/pages/v1.17/37.adoc new file mode 100644 index 00000000..b0065699 --- /dev/null +++ b/CN/modules/ROOT/pages/v1.17/37.adoc @@ -0,0 +1,114 @@ + +:sectnums: +:sectnumlevels: 5 +:imagesdir: ./_images + += pg_cron + +== 概述 +在 PostgreSQL 中运行周期性任务,例如执行 VACUUM或删除旧数据,是一种常见需求。实现这一点的简单方法是配置 cron或其他外部守护进程,使其定期连接到数据库并运行命令。然而,随着数据库越来越多地作为托管服务或独立容器运行,配置和运行一个单独的守护进程通常变得不切实际。此外,很难让您的 cron任务感知故障转移,或者跨集群节点调度任务。 + +pg_cron 是 PostgreSQL 的开源定时任务扩展,允许直接在数据库内部设置 cron 风格的任务调度,用于自动化数据维护任务(清理,聚合), 数据库健康检查,执行存储过程和自定义函数等操作。它将cron任务存储在表中,周期性任务会随着 PostgreSQL 服务器自动进行故障转移。详情可以参见 https://github.com/citusdata/pg_cron[pg_cron文档]。 + +== 安装配置 + +[TIP] +源码安装环境为 Ubuntu 24.04(x86_64),环境中已经安装了IvorySQL1.17及以上版本,安装路径为/usr/local/ivorysql/ivorysql-1 + +=== 源码安装 + +[literal] +---- +# 拉取pg_cron源码 +git clone https://github.com/citusdata/pg_cron.git +cd pg_cron +# 将pg_config的路径设置到PATH环境变量里,eg: +export PATH=/usr/local/ivorysql/ivorysql-1/bin/:$PATH +make +make install +---- + +=== 配置文件 (ivorysql.conf) + +[literal] +---- +# 共享预加载扩展 +shared_preload_libraries = 'pg_cron' + +# 指定任务元数据存储库(默认当前库) +cron.database_name = 'ivorysql' + +# 允许的最大并发任务数 +cron.max_running_jobs = 5 +---- + +=== 重启服务 + +[literal] +---- +pg_ctl restart -D ./data -l logfile +---- + +=== 创建Extension并确认pg_cron版本 + +psql 连接到数据库,执行如下命令: +[literal] +---- +ivorysql=# CREATE extension pg_cron; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'pg_cron'; + name | default_version | installed_version | comment +---------+-----------------+-------------------+--------------------------- + pg_cron | 1.6 | |Job scheduler for PostgreSQL +(1 row) +---- + +== 核心功能使用 + +=== 创建定时任务 + +``` +SELECT cron.schedule( + 'nightly-data-cleanup', -- 任务名称(唯一标识) + '0 3 * * *', -- cron表达式(每天UTC 3:00) + $$DELETE FROM logs + WHERE created_at < now() - interval '30 days'$$ -- 执行SQL +); +``` + +cron表达式速查表: + +|==== +|示例|含义 +|'0 * * * *'|每小时整点执行 +|'*/15 * * * *'|每15分钟执行 +|'0 9 * * 1-5'|工作日早9点执行 +|'0 1 1 * *'|每月1日凌晨1点执行 +|==== + +pg_cron还允许使用 '$'表示月份的最后一天。 + +=== 任务管理 + +``` +# 查看所有任务 +SELECT * FROM cron.job; +``` + +image::p31.png[] + +``` +# 查看任务执行历史 +SELECT * FROM cron.job_run_details ORDER BY start_time DESC LIMIT 10; +``` + +image::p32.png[] + +``` +# 删除任务 +SELECT cron.unschedule('nightly-data-cleanup'); + +# 暂停任务(更新状态) +UPDATE cron.job SET active = false WHERE jobname = 'delete-job-run-details'; +``` diff --git a/CN/modules/ROOT/pages/v1.17/38.adoc b/CN/modules/ROOT/pages/v1.17/38.adoc new file mode 100644 index 00000000..1f60ff79 --- /dev/null +++ b/CN/modules/ROOT/pages/v1.17/38.adoc @@ -0,0 +1,59 @@ + +:sectnums: +:sectnumlevels: 5 + += pgsql-http + +== 概述 +pgsql-http 是一个为 PostgreSQL 数据库设计的开源扩展,它允许用户直接在数据库内部发起 HTTP 请求,扮演了一个内置 Web 客户端的角色。该扩展的核心目的是打通数据库与外部 Web 服务之间的壁垒,使得通过简单的 SQL 函数调用即可与外部 Web 服务、API 端点进行交互,无需依赖外部应用程序或中间件。 + +借助此扩展,开发者可以在 SQL 查询、触发器或存储过程中直接获取网络数据(GET)、提交数据(POST/PUT)、更新(PATCH)或删除(DELETE)远程资源。它提供了丰富的功能,包括设置请求头、自动处理 URL 编码、发送 JSON 数据以及解析响应状态、头部和内容,极大简化了将外部数据集成到数据库操作中的流程。 + +其典型应用场景包括:实时获取外部数据(如汇率、天气信息)并存入表;在数据变更时通过触发器自动通知微服务;对数据库中的数据进行清洗后直接提交至外部 API 等。它为构建以数据库为中心的集成应用提供了强大而灵活的解决方案。 + +== 安装 +IvorySQL的安装包里已经集成了pgsql-http插件,如果使用安装包安装的IvorySQL,通常不需要再手动安装pgsql-http即可使用。其它安装方式可以参考下面的源码安装步骤。 + +[TIP] +源码安装环境为 Ubuntu 24.04(x86_64),环境中已经安装了IvorySQL1.17及以上版本,安装路径为/usr/local/ivorysql/ivorysql-1 + +=== 源码安装 + +** 安装依赖 + +对libcurl有依赖,libcurl的开发文件(例如 libcurl4-openssl-dev)需要提前安装上 +[literal] +---- +#安装依赖 +sudo apt install libcurl4-openssl-dev +---- + +** 编译安装 + +从https://github.com/pramsey/pgsql-http/releases/tag/v1.7.0 下载 1.7.0的源码包 pgsql-http-1.7.0.tar.gz +[literal] +---- +tar xvf pgsql-http-1.7.0.tar.gz +cd pgsql-http-1.7.0 +# 确保pg_config在PATH里可以访问,eg: /usr/local/ivorysql/ivorysql-1/bin/pg_config +make +sudo make install +---- + +== 创建Extension并确认http版本 + +psql 连接到数据库,执行如下命令: +[literal] +---- +ivorysql=# CREATE extension http; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'http'; + name | default_version | installed_version | comment +-----------+-----------------+-------------------+------------------------------------------------------------------------- + http | 1.7 | 1.7 | HTTP client for PostgreSQL, allows web page retrieval inside the database. +(1 row) +---- + +== 使用 +关于pgsql-http的使用,请参阅 https://github.com/pramsey/pgsql-http[pgsql-http官方文档] \ No newline at end of file diff --git a/CN/modules/ROOT/pages/v1.17/40.adoc b/CN/modules/ROOT/pages/v1.17/40.adoc new file mode 100644 index 00000000..0a10a199 --- /dev/null +++ b/CN/modules/ROOT/pages/v1.17/40.adoc @@ -0,0 +1,69 @@ + +:sectnums: +:sectnumlevels: 5 + += pgvectorscale + +== 概述 +pgvectorscale 是 Timescale 公司推出的 PostgreSQL 扩展,旨在对流行的 pgvector 扩展进行高性能、高成本效益的补充。它专为 AI 应用中的大规模向量工作负载而设计,通过引入创新的索引算法和压缩技术,显著提升了向量相似性搜索的性能并降低了存储成本。 + +该扩展的核心特性包括基于微软 DiskANN 研究的新索引类型 StreamingDiskANN、改进的统计二进制量化(SBQ)压缩方法,以及支持标签过滤的向量搜索功能。在基准测试中,它在处理大规模嵌入向量时展现出卓越的性能:与专用向量数据库服务相比,可实现高达 28 倍的低延迟和 16 倍的查询吞吐量,同时节省约 75% 的成本。 + +pgvectorscale 完全兼容 pgvector 的数据类型和查询语法,确保了无缝的集成和迁移体验。它使用 Rust 语言和 PGRX 框架开发,非常适合需要在 PostgreSQL 内进行高效海量向量搜索的生产级应用。 + +== 安装 +IvorySQL的安装包里已经集成了pgvectorscale插件,如果使用安装包安装的IvorySQL,通常不需要再手动安装pgvectorscale即可使用。其它安装方式可以参考下面的源码安装步骤。 + +[TIP] +源码安装环境为 Ubuntu 24.04(x86_64),环境中已经安装了IvorySQL1.17及以上版本,安装路径为/usr/local/ivorysql/ivorysql-1 + +=== 源码安装 + +** 安装Rust工具链 + +[literal] +---- +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +---- + +** 下载pgvectorscale源码 + +从https://github.com/timescale/pgvectorscale/releases/tag/0.8.0 下载 0.8.0的源码包 pgvectorscale-0.8.0.tar.gz +[literal] +---- +tar xvf pgvectorscale-0.8.0.tar.gz +cd pgvectorscale-0.8.0/pgvectorscale +---- + +** 安装cargo-pgrx + +[literal] +---- +cargo install --locked cargo-pgrx --version $(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "pgrx") | .version') +cargo pgrx init --pg14 pg_config +---- + +** 编译并安装扩展 + +[literal] +---- +cargo pgrx install --release +---- + +== 创建Extension并确认pgvectorscale版本 + +psql 连接到数据库,执行如下命令: +[literal] +---- +ivorysql=# CREATE EXTENSION IF NOT EXISTS vectorscale CASCADE; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'vectorscale'; + name | default_version | installed_version | comment +----------- +-----------------+-------------------+-------------------------------------------- + vectorscale | 0.8.0 | 0.8.0 | diskann access method for vector search. +(1 row) +---- + +== 使用 +关于pgvectorscale的使用,请参阅 https://github.com/timescale/pgvectorscale[pgvectorscale官方文档] \ No newline at end of file diff --git a/EN/modules/ROOT/images/p31.png b/EN/modules/ROOT/images/p31.png new file mode 100644 index 00000000..51e0e02a Binary files /dev/null and b/EN/modules/ROOT/images/p31.png differ diff --git a/EN/modules/ROOT/images/p32.png b/EN/modules/ROOT/images/p32.png new file mode 100644 index 00000000..d8cc211d Binary files /dev/null and b/EN/modules/ROOT/images/p32.png differ diff --git a/EN/modules/ROOT/nav.adoc b/EN/modules/ROOT/nav.adoc index 9991f2a4..2701d31c 100644 --- a/EN/modules/ROOT/nav.adoc +++ b/EN/modules/ROOT/nav.adoc @@ -10,8 +10,15 @@ ** xref:v1.17/7.adoc[Developer] ** xref:v1.17/8.adoc[Operation Management] * IvorySQL Ecosystem +** xref:v1.17/33.adoc[Overview] ** xref:v1.17/9.adoc[PostGIS] ** xref:v1.17/10.adoc[pgvector] +** xref:v1.17/34.adoc[PGroonga] +** xref:v1.17/35.adoc[pgddl (DDL Extractor)] +** xref:v1.17/36.adoc[pgRouting] +** xref:v1.17/37.adoc[pg_cron] +** xref:v1.17/38.adoc[pgsql-http] +** xref:v1.17/40.adoc[pgvectorscale] * List of Oracle compatible features ** xref:v1.17/11.adoc[1、Ivorysql frame design] ** xref:v1.17/12.adoc[2、GUC Framework] diff --git a/EN/modules/ROOT/pages/v1.17/10.adoc b/EN/modules/ROOT/pages/v1.17/10.adoc index bbd30b2f..54247d83 100644 --- a/EN/modules/ROOT/pages/v1.17/10.adoc +++ b/EN/modules/ROOT/pages/v1.17/10.adoc @@ -38,7 +38,7 @@ export PG_CONFIG=/usr/local/ivorysql/ivorysql-4/bin/pg_config ** Pull pg_vector source code ``` -git clone --branch v0.6.2 https://github.com/pgvector/pgvector.git +git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git ``` ** Install pgvector diff --git a/EN/modules/ROOT/pages/v1.17/33.adoc b/EN/modules/ROOT/pages/v1.17/33.adoc new file mode 100644 index 00000000..5c9236dc --- /dev/null +++ b/EN/modules/ROOT/pages/v1.17/33.adoc @@ -0,0 +1,27 @@ +:sectnums: +:sectnumlevels: 5 + + +[discrete] +== IvorySQL Ecosystem Plugin Compatibility List + +IvorySQL, as an advanced open-source database compatible with Oracle and based on PostgreSQL, has powerful extension capabilities and supports a rich ecosystem of plugins. These plugins can help users enhance database functionality in different scenarios, including geospatial information processing, vector retrieval, full-text search, data definition extraction, and path planning. The following is a list of major plugins currently officially compatible with and supported by IvorySQL: + ++ + +[cols="2,1,3,3"] +|==== +|*Plugin Name*|*Version*|*Function Description*|*Use Cases* +| xref:v1.17/9.adoc[PostGIS] | 3.4.0 | Provides geospatial data support for IvorySQL, including spatial indexes, spatial functions, and geographic object storage | Geographic Information Systems (GIS), map services, location data analysis +| xref:v1.17/10.adoc[pgvector] | 0.8.0 | Supports vector similarity search, can be used to store and retrieve high-dimensional vector data| AI applications, image retrieval, recommendation systems, semantic search +| xref:v1.17/34.adoc[PGroonga] | 4.0.1 | Provides multilingual full-text search functionality, supports ultra-fast text retrieval and fuzzy matching | Log analysis, multilingual content search, real-time search engines +| xref:v1.17/35.adoc[pgddl (DDL Extractor)] | 0.20 | Extracts DDL (Data Definition Language) statements from databases, facilitating version management and migration | Database version control, CI/CD integration, structure comparison and synchronization +| xref:v1.17/36.adoc[pgRouting] | 3.5.1 | Geographic data-based path planning extension, supports shortest path, traveling salesman problem and other algorithms | Logistics planning, traffic network analysis, path optimization services +| xref:v1.17/37.adoc[pg_cron]​ | 1.6.0 | Provides database-internal scheduled task scheduling functionality, supports regular SQL statement execution | Data cleanup, regular statistics, automated maintenance tasks +| xref:v1.17/38.adoc[pgsql-http]​ | 1.7.0 | Allows HTTP requests to be initiated in SQL, interacting with external web services | Data collection, API integration, microservice calls +| xref:v1.17/40.adoc[pgvectorscale] | 0.8.0 | Provides sharding and distributed extension support for vector data, improving large-scale vector processing performance | Distributed vector databases, high-concurrency vector queries +|==== + +These plugins have all been tested and adapted by the IvorySQL team to ensure stable operation in the IvorySQL environment. Users can select appropriate plugins based on business needs to further enhance the capabilities and flexibility of the database system. + +We will continue to expand and enrich the IvorySQL plugin ecosystem. Community developers are welcome to submit new plugin adaptation suggestions or code contributions. For more detailed usage methods and the latest compatible versions of each plugin, please refer to the corresponding documentation chapters for each plugin. diff --git a/EN/modules/ROOT/pages/v1.17/34.adoc b/EN/modules/ROOT/pages/v1.17/34.adoc new file mode 100644 index 00000000..fec0b596 --- /dev/null +++ b/EN/modules/ROOT/pages/v1.17/34.adoc @@ -0,0 +1,113 @@ +:sectnums: +:sectnumlevels: 5 + += PGroonga + +== Overview +PostgreSQL has built-in full-text search functionality, but when dealing with large-scale data, complex queries, and non-English languages (especially CJK languages like Chinese, Japanese, and Korean), its functionality and performance may not meet the requirements of high-performance applications. + +PGroonga was created to address this need. It is a PostgreSQL extension that deeply integrates Groonga, a high-performance full-featured full-text search engine, with the PostgreSQL database. Groonga itself is an excellent open-source search engine, renowned for its extreme speed and rich functionality, particularly excelling at handling multilingual text. PGroonga's mission is to seamlessly bring Groonga's powerful capabilities into the PostgreSQL world, providing users with an experience that far exceeds native full-text search. + +== Installation + +Based on the development environment, users can choose the appropriate installation method for PGroonga from the https://pgroonga.github.io/install[PGroonga Installation] page. + +[NOTE] +PGroonga plugin is already integrated in the IvorySQL installation package. If you use the installation package to install IvorySQL, you typically do not need to manually install PGroonga and can use it directly. + +=== Source Installation +In addition to the installation methods provided by the PGroonga community, the IvorySQL community also provides source installation methods. The source installation environment is Ubuntu 24.04 (x86_64). + +[TIP] +IvorySQL 1.17 or higher version is already installed in the environment, with the installation path at /usr/local/ivorysql/ivorysql-1 + +==== Install groonga + +** Install dependency kytea +[literal] +---- +git clone https://github.com/neubig/kytea.git +autoreconf -i +./configure +make +sudo make install +---- + +** Install dependency libzmq +[literal] +---- +Download zeromq-4.3.5.tar.gz from https://github.com/zeromq/libzmq/releases/tag/v4.3.5 +tar xvf zeromq-4.3.5.tar.gz +cd zeromq-4.3.5/ +./configure +make +sudo make install +---- + +** Download groonga package and install specified dependencies +[literal] +---- +wget https://packages.groonga.org/source/groonga/groonga-latest.tar.gz +tar xvf groonga-15.1.5.tar.gz +cd groonga-15.1.5 +# Run this script to install dependencies, supporting apt and dnf package managers +./ setup.sh +---- + +** Compile and install +[literal] +---- +# -S specifies the groonga source directory, -B specifies the build directory, which is a directory outside the source directory used only for building +cmake -S /home/ivorysql/groonga-15.1.5 -B /home/ivorysql/groonga_build --preset=release-maximum +cmake --build /home/ivorysql/groonga_build +sudo cmake --install /home/ivorysql/groonga_build +# Update dynamic library cache +sudo ldconfig +---- + +** Verify groonga installation success +[literal] +---- +$ groonga --version +Groonga 15.1.5 [Linux,x86_64,utf8,match-escalation-threshold=0,nfkc,mecab,message-pack,mruby,onigmo,zlib,lz4,zstandard,epoll,apache-arrow,xxhash,blosc,bfloat16,h3,simdjson,llama.cpp] +---- + +==== Install pgroonga +[literal] +---- +wget https://packages.groonga.org/source/pgroonga/pgroonga-4.0.1.tar.gz +tar xvf pgroonga-4.0.1.tar.gz +cd pgroonga-4.0.1 +---- + +When compiling PGroonga, there is an option: HAVE_MSGPACK=1, which is used to support WAL. Using this option requires installing msgpack-c 1.4.1 or higher. On Debian-based platforms, use the libmsgpack-dev package, and on CentOS 7, use msgpack-devel. +[literal] +---- +# Install dependencies +sudo apt install libmsgpack-dev +---- + +Before running make, ensure that the path of the pg_config command is in the PATH environment variable. +[literal] +---- +make HAVE_MSGPACK=1 +make install +---- + +== Create Extension and Confirm PGroonga Version + +Connect to the database with psql and execute the following commands: +[literal] +---- +ivorysql=# CREATE extension pgroonga; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'pgroonga'; + name | default_version | installed_version | comment +---------+-----------------+-------------------+------------------------------------------------------------------------------- + pgroonga| 4.0.1 | 4.0.1 | Super fast and all languages supported full text search index based on Groonga +(1 row) +---- + +== Usage +For PGroonga usage, please refer to the https://pgroonga.github.io/tutorial[PGroonga Official Documentation] diff --git a/EN/modules/ROOT/pages/v1.17/35.adoc b/EN/modules/ROOT/pages/v1.17/35.adoc new file mode 100644 index 00000000..2f78babd --- /dev/null +++ b/EN/modules/ROOT/pages/v1.17/35.adoc @@ -0,0 +1,45 @@ +:sectnums: +:sectnumlevels: 5 + += pgddl (DDL Extractor) + +== Overview +pgddl is a SQL function extension specifically designed for PostgreSQL databases. It can generate clear, formatted SQL DDL (Data Definition Language) scripts directly from the database system catalog, such as CREATE TABLE or ALTER FUNCTION. It solves the problem that PostgreSQL natively lacks commands like SHOW CREATE TABLE, allowing users to easily obtain object creation statements in a pure SQL environment without relying on external tools (such as pg_dump). + +This extension provides a complete solution through a set of simple SQL functions, with advantages including: requiring only SQL queries to operate, supporting flexible object filtering through WHERE clauses, and intelligently handling dependencies between objects to generate complete scripts including Drop and Create steps. This makes it particularly suitable for scenarios such as database change management, upgrade script writing, and structural auditing. + +It should be noted that ddlx is still under development and may not yet cover all PostgreSQL object types and advanced options. Generated scripts should always be checked and tested in non-production environments first to ensure their correctness and safety. + +== Installation + +[TIP] +The source installation environment is Ubuntu 24.04 (x86_64). IvorySQL 1.17 or higher version is already installed in the environment, with the installation path at /usr/local/ivorysql/ivorysql-1 + +=== Source Installation +Download pgddl-0.20.tar.gz from https://github.com/lacanoid/pgddl/releases/tag/0.20 and extract it. + +[literal] +---- +cd pgddl-0.20 +# Set the PG_CONFIG environment variable to the pg_config path, e.g.: /usr/local/ivorysql/ivorysql-4/bin/pg_config +make PG_CONFIG=/path/to/pg_config +make PG_CONFIG=/path/to/pg_config install +---- + +== Create Extension and Confirm ddlx Version + +Connect to the database with psql and execute the following commands: +[literal] +---- +ivorysql=# CREATE extension ddlx; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'ddlx'; + name | default_version | installed_version | comment +------+-----------------+-------------------+------------------------- + ddlx | 0.20 | 0.20 | DDL eXtractor functions +(1 row) +---- + +== Usage +For pgddl usage, please refer to the https://github.com/lacanoid/pgddl[ddlx Official Documentation] diff --git a/EN/modules/ROOT/pages/v1.17/36.adoc b/EN/modules/ROOT/pages/v1.17/36.adoc new file mode 100644 index 00000000..c1ca8605 --- /dev/null +++ b/EN/modules/ROOT/pages/v1.17/36.adoc @@ -0,0 +1,59 @@ +:sectnums: +:sectnumlevels: 5 + += pgRouting + +== Overview +pgRouting is an open-source geospatial routing extension library built on PostgreSQL/PostGIS databases. It endows databases with powerful network analysis capabilities, enabling them to handle complex path planning and graph theory computation problems, such as calculating the shortest path between two points, performing Traveling Salesman Problem (TSP) analysis, or computing service area coverage. It embeds routing algorithms directly into the database, thereby avoiding complex data transfer and computation at the application layer. + +The core advantage of this extension lies in its ability to leverage PostgreSQL's powerful data management capabilities and PostGIS's rich spatial functions to perform efficient computation on spatial network data directly within the database. This not only simplifies application development processes but also significantly improves the performance of large-scale network analysis by reducing data movement. + +pgRouting is widely used in logistics and distribution, traffic navigation, network analysis, urban planning, and supply chain management, among other fields. Its open-source nature has attracted continuous contributions and improvements from developers worldwide, making it one of the preferred tools for path analysis and network solving in the spatial database domain. + +== Installation + +[TIP] +The source installation environment is Ubuntu 24.04 (x86_64). IvorySQL 1.17 or higher version is already installed in the environment, with the installation path at /usr/local/ivorysql/ivorysql-1 + +=== Source Installation + +** Install dependencies + +It depends on perl, which is generally already installed when installing IvorySQL, so no need to install it here. +CMake version requirement >= 3.12, Boost version >= 1.56 +[literal] +---- +# Install dependencies +sudo apt install cmake libboost-all-dev +---- + +** Compile and install +[literal] +---- +wget https://github.com/pgRouting/pgrouting/releases/download/v3.5.1/pgrouting-3.5.1.tar.gz +tar xvf pgrouting-3.5.1.tar.gz +cd pgrouting-3.5.1 +mkdir build +cd build +cmake .. -DPOSTGRESQL_PG_CONFIG=/path/to/pg_config # eg: /usr/local/ivorysql/ivorysql-4/bin/pg_config +make +sudo make install +---- + +== Create Extension and Confirm pgRouting Version + +Connect to the database with psql and execute the following commands: +[literal] +---- +ivorysql=# CREATE extension pgrouting; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'pgrouting'; + name | default_version | installed_version | comment +-----------+-----------------+-------------------+--------------------- + pgrouting | 3.5.1 | | pgRouting Extension +(1 row) +---- + +== Usage +For pgRouting usage, please refer to the https://docs.pgrouting.org/[pgRouting Official Documentation] diff --git a/EN/modules/ROOT/pages/v1.17/37.adoc b/EN/modules/ROOT/pages/v1.17/37.adoc new file mode 100644 index 00000000..5bb3976f --- /dev/null +++ b/EN/modules/ROOT/pages/v1.17/37.adoc @@ -0,0 +1,117 @@ +:sectnums: +:sectnumlevels: 5 +:imagesdir: ./_images + += pg_cron + +== Overview +Running periodic tasks in PostgreSQL, such as executing VACUUM or deleting old data, is a common requirement. A simple way to achieve this is to configure cron or other external daemons to periodically connect to the database and run commands. However, as databases increasingly run as managed services or standalone containers, configuring and running a separate daemon often becomes impractical. Additionally, it's difficult to make your cron jobs aware of failover or schedule tasks across cluster nodes. + +pg_cron is an open-source scheduled task extension for PostgreSQL that allows setting up cron-style task scheduling directly within the database for automating data maintenance tasks (cleanup, aggregation), database health checks, executing stored procedures and custom functions, and other operations. It stores cron jobs in tables, and periodic tasks automatically fail over with the PostgreSQL server. For more details, see https://github.com/citusdata/pg_cron[pg_cron documentation]. + +== Installation and Configuration + +[TIP] +The source installation environment is Ubuntu 24.04 (x86_64). IvorySQL 1.17 and above is already installed in the environment, with the installation path at /usr/local/ivorysql/ivorysql-1 + +=== Source Installation + +[literal] +---- +# Clone pg_cron source code +git clone https://github.com/citusdata/pg_cron.git +cd pg_cron +# Set pg_config path to PATH environment variable, e.g.: +export PATH=/usr/local/ivorysql/ivorysql-1/bin/:$PATH +make +make install +---- + +=== Configuration File (ivorysql.conf) + +[literal] +---- +# Shared preload extensions +shared_preload_libraries = 'pg_cron' + +# Specify task metadata storage database (default current database) +cron.database_name = 'ivorysql' + +# Maximum number of concurrent tasks allowed +cron.max_running_jobs = 5 +---- + +=== Restart Service + +[literal] +---- +pg_ctl restart -D ./data -l logfile +---- + +=== Create Extension and Confirm pg_cron Version + +Connect to the database with psql and execute the following commands: +[literal] +---- +ivorysql=# CREATE extension pg_cron; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'pg_cron'; + name | default_version | installed_version | comment +---------+-----------------+-------------------+--------------------------- + pg_cron | 1.6 | |Job scheduler for PostgreSQL +(1 row) +---- + +== Core Functionality Usage + +=== Creating Scheduled Tasks + +[literal] +---- +SELECT cron.schedule( + 'nightly-data-cleanup', -- Task name (unique identifier) + '0 3 * * *', -- Cron expression (daily at UTC 3:00) + $$DELETE FROM logs + WHERE created_at < now() - interval '30 days'$$ -- SQL to execute +); +---- + +Cron expression quick reference: + +|==== +|Example|Meaning +|'0 * * * *'|Execute every hour on the hour +|'*/15 * * * *'|Execute every 15 minutes +|'0 9 * * 1-5'|Execute at 9 AM on weekdays +|'0 1 1 * *'|Execute at 1 AM on the 1st of every month +|==== + +pg_cron also allows using '$' to represent the last day of the month. + +=== Task Management + +[literal] +---- +# View all tasks +SELECT * FROM cron.job; +---- + +image::p31.png[] + +[literal] +---- +# View task execution history +SELECT * FROM cron.job_run_details ORDER BY start_time DESC LIMIT 10; +---- + +image::p32.png[] + +[literal] +---- +# Delete task +SELECT cron.unschedule('nightly-data-cleanup'); + +# Pause task (update status) +UPDATE cron.job SET active = false WHERE jobname = 'delete-job-run-details'; +---- diff --git a/EN/modules/ROOT/pages/v1.17/38.adoc b/EN/modules/ROOT/pages/v1.17/38.adoc new file mode 100644 index 00000000..82a28a95 --- /dev/null +++ b/EN/modules/ROOT/pages/v1.17/38.adoc @@ -0,0 +1,58 @@ +:sectnums: +:sectnumlevels: 5 + += pgsql-http + +== Overview +pgsql-http is an open-source extension designed for PostgreSQL databases that allows users to initiate HTTP requests directly within the database, acting as a built-in web client. The core purpose of this extension is to bridge the gap between databases and external web services, enabling interaction with external web services and API endpoints through simple SQL function calls without relying on external applications or middleware. + +With this extension, developers can directly retrieve network data (GET), submit data (POST/PUT), update (PATCH), or delete (DELETE) remote resources in SQL queries, triggers, or stored procedures. It provides rich functionality, including setting request headers, automatic URL encoding, sending JSON data, and parsing response status, headers, and content, greatly simplifying the process of integrating external data into database operations. + +Typical application scenarios include: real-time retrieval of external data (such as exchange rates, weather information) and storing it in tables; automatic notification of microservices through triggers when data changes; cleaning data in the database and directly submitting it to external APIs. It provides a powerful and flexible solution for building database-centric integrated applications. + +== Installation +The pgsql-http plugin has been integrated into the IvorySQL installation package. If IvorySQL is installed using the installation package, pgsql-http can usually be used without manual installation. Other installation methods can refer to the source code installation steps below. + +[TIP] +The source installation environment is Ubuntu 24.04 (x86_64). IvorySQL 1.17 and above is already installed in the environment, with the installation path at /usr/local/ivorysql/ivorysql-1 + +=== Source Installation + +** Install Dependencies + +It depends on libcurl, and libcurl development files (such as libcurl4-openssl-dev) need to be installed in advance +[literal] +---- +# Install dependencies +sudo apt install libcurl4-openssl-dev +---- + +** Compile and Install + +Download the 1.7.0 source package pgsql-http-1.7.0.tar.gz from https://github.com/pramsey/pgsql-http/releases/tag/v1.7.0 +[literal] +---- +tar xvf pgsql-http-1.7.0.tar.gz +cd pgsql-http-1.7.0 +# Ensure pg_config is accessible in PATH, e.g.: /usr/local/ivorysql/ivorysql-1/bin/pg_config +make +sudo make install +---- + +== Create Extension and Confirm http Version + +Connect to the database with psql and execute the following commands: +[literal] +---- +ivorysql=# CREATE extension http; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'http'; + name | default_version | installed_version | comment +-----------+-----------------+-------------------+------------------------------------------------------------------------- + http | 1.7 | 1.7 | HTTP client for PostgreSQL, allows web page retrieval inside the database. +(1 row) +---- + +== Usage +For pgsql-http usage, please refer to https://github.com/pramsey/pgsql-http[pgsql-http official documentation] diff --git a/EN/modules/ROOT/pages/v1.17/40.adoc b/EN/modules/ROOT/pages/v1.17/40.adoc new file mode 100644 index 00000000..d7cfa491 --- /dev/null +++ b/EN/modules/ROOT/pages/v1.17/40.adoc @@ -0,0 +1,68 @@ +:sectnums: +:sectnumlevels: 5 + += pgvectorscale + +== Overview +pgvectorscale is a PostgreSQL extension launched by Timescale, designed to provide high-performance, cost-effective supplementation to the popular pgvector extension. It is specifically designed for large-scale vector workloads in AI applications, significantly improving the performance of vector similarity search and reducing storage costs through innovative indexing algorithms and compression techniques. + +The core features of this extension include the new index type StreamingDiskANN based on Microsoft's DiskANN research, improved Statistical Binary Quantization (SBQ) compression methods, and vector search functionality with label filtering support. In benchmark tests, it demonstrates exceptional performance when handling large-scale embedding vectors: compared to dedicated vector database services, it can achieve up to 28x lower latency and 16x query throughput while saving approximately 75% in costs. + +pgvectorscale is fully compatible with pgvector's data types and query syntax, ensuring seamless integration and migration experience. It is developed using Rust language and PGRX framework, making it very suitable for production-level applications that require efficient massive vector search within PostgreSQL. + +== Installation +The pgvectorscale plugin has been integrated into the IvorySQL installation package. If IvorySQL is installed using the installation package, pgvectorscale can usually be used without manual installation. Other installation methods can refer to the source code installation steps below. + +[TIP] +The source installation environment is Ubuntu 24.04 (x86_64). IvorySQL 1.17 and above is already installed in the environment, with the installation path at /usr/local/ivorysql/ivorysql-1 + +=== Source Installation + +** Install Rust Toolchain + +[literal] +---- +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +---- + +** Download pgvectorscale Source Code + +Download the 0.8.0 source package pgvectorscale-0.8.0.tar.gz from https://github.com/timescale/pgvectorscale/releases/tag/0.8.0 +[literal] +---- +tar xvf pgvectorscale-0.8.0.tar.gz +cd pgvectorscale-0.8.0/pgvectorscale +---- + +** Install cargo-pgrx + +[literal] +---- +cargo install --locked cargo-pgrx --version $(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "pgrx") | .version') +cargo pgrx init --pg14 pg_config +---- + +** Compile and Install Extension + +[literal] +---- +cargo pgrx install --release +---- + +== Create Extension and Confirm pgvectorscale Version + +Connect to the database with psql and execute the following commands: +[literal] +---- +ivorysql=# CREATE EXTENSION IF NOT EXISTS vectorscale CASCADE; +CREATE EXTENSION + +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'vectorscale'; + name | default_version | installed_version | comment +----------- +-----------------+-------------------+-------------------------------------------- + vectorscale | 0.8.0 | 0.8.0 | diskann access method for vector search. +(1 row) +---- + +== Usage +For pgvectorscale usage, please refer to https://github.com/timescale/pgvectorscale[pgvectorscale official documentation]