Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CN/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*** xref:master/5.4.adoc[pg_cron]
*** xref:master/5.5.adoc[pgsql-http]
*** xref:master/5.6.adoc[plpgsql_check]
*** xref:master/5.7.adoc[pgroonga]
** IvorySQL架构设计
*** 查询处理
**** xref:master/6.1.1.adoc[双parser]
Expand Down
1 change: 1 addition & 0 deletions CN/modules/ROOT/pages/master/5.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ IvorySQL 作为一款兼容 Oracle 且基于 PostgreSQL 的高级开源数据库
| xref:master/5.4.adoc[pg_cron]​ | 1.6.0 | 提供数据库内部的定时任务调度功能,支持定期执行SQL语句 | 数据清理、定期统计、自动化维护任务
| xref:master/5.5.adoc[pgsql-http]​ | 1.7.0 | 允许在SQL中发起HTTP请求,与外部Web服务进行交互 | 数据采集、API集成、微服务调用
| xref:master/5.6.adoc[plpgsql_check] | 2.8 | 提供PL/pgSQL代码的静态分析功能,可在开发阶段发现潜在错误 | 存储过程开发、代码质量检查、调试优化
| xref:master/5.7.adoc[pgroonga] | 4.0.4 | 提供​非英语语言全文搜索功能,满足高性能应用的需求 | 中日韩等语言的全文搜索功能
|====

这些插件均经过 IvorySQL 团队的测试和适配,确保在 IvorySQL 环境下稳定运行。用户可以根据业务需求选择合适的插件,进一步提升数据库系统的能力和灵活性。
Expand Down
94 changes: 94 additions & 0 deletions CN/modules/ROOT/pages/master/5.7.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

:sectnums:
:sectnumlevels: 5

= PGroonga

== 概述
PostgreSQL 内置了全文搜索功能,但在处理​​大规模数据​​、​​复杂查询​​以及​​非英语语言(特别是中日韩等 CJK 语言)​​ 时,其功能和性能可能无法满足高性能应用的需求。

PGroonga 应运而生,它是一个 PostgreSQL 的扩展插件,将 ​​Groonga​​ 这款高性能的全功能全文搜索引擎与 PostgreSQL 数据库深度融合。Groonga 本身是一个优秀的开源搜索引擎,以其极致的速度和丰富的功能著称,尤其擅长处理多语言文本。PGroonga 的使命就是将 Groonga 的强大能力无缝地带入 PostgreSQL 的世界,为用户提供远超原生全文搜索的体验。

== 安装
[NOTE]
IvorySQL的安装包里已经集成了PGroonga插件,如果使用安装包安装的IvorySQL,通常不需要再手动安装PGroonga,直接跳过安装步骤即可。

用户可从 https://pgroonga.github.io/install[PGroonga package安装] 页面选择适合自己的方式进行PGroonga安装。

IvorySQL社区提供了源码安装步骤,下面以PGroonga v4.0.4为例进行演示。

=== 安装依赖

环境
```
操作系统:Ubuntu 24.04
CPU架构:x86_64
IvorySQL: v5.0
```

==== 安装 msgpack-c

编译PGroonga,有个配置选项:HAVE_MSGPACK=1,它是用于支持WAL,使用这个选项需要安装msgpack-c 1.4.1或者更高版本。

```
sudo apt install libmsgpack-dev
```
==== 安装 Groonga

确保Groonga >= 14.0.0

```
sudo apt install groonga libgroonga-dev
```
验证Groonga安装成功
```bash
highgo@ubuntu:~/work/IvorySQL/inst$ groonga --version
Groonga 15.1.7 [Linux,x86_64,utf8,match-escalation-threshold=0,nfkc,mecab,message-pack,mruby,onigmo,zlib,lz4,zstandard,epoll,apache-arrow,xxhash,blosc,h3,simdjson,llama.cpp]
```


=== 编译安装PGroonga

==== 下载解压源码

```bash
wget https://packages.groonga.org/source/pgroonga/pgroonga-4.0.4.tar.gz
tar xvf pgroonga-4.0.4.tar.gz
cd pgroonga-4.0.4
```
==== 编译
运行make前确保`pg_config`命令的路径在`PATH`环境变量里,例如IvorySQL安装的路径是`~/work/IvorySQL/inst`,则环境变量设置如下:

```bash
export PGHOME=~/work/IvorySQL/inst
export PGDATA=$PGHOME/data
export PATH=$PGHOME/bin:$PATH
```
然后执行以下命令进行编译和安装:
```bash
make HAVE_MSGPACK=1
make install
```

== 创建Extension并确认PGroonga版本


psql 连接到数据库的pg模式下,执行命令:
```sql
postgres=# CREATE extension pgroonga;
CREATE EXTENSION
postgres=# SELECT * FROM pg_available_extensions WHERE name = 'pgroonga';
name | default_version | installed_version | comment
----------+-----------------+-------------------+--------------------------------------------------------------------------------
pgroonga | 4.0.4 | 4.0.4 | Super fast and all languages supported full text search index based on Groonga
(1 row)

postgres=# select version();
version
--------------------------------------------------------------------------------
PostgreSQL (IvorySQL 5.0) 18.0 on x86_64-linux, compiled by gcc-13.3.0, 64-bit
(1 row)
```

== 使用
关于PGroonga的使用,请参阅 https://pgroonga.github.io/tutorial[PGroonga官方文档]
6 changes: 3 additions & 3 deletions CN/modules/ROOT/pages/master/6.4.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

= **功能概述**

IvorySQL提供兼容Oracle内置函数`SYS_CONTEXT('namespace', 'parameter' [, length ])`,
IvorySQL提供兼容Oracle内置函数 ```SYS_CONTEXT('namespace', 'parameter' [, length ])``` ,
返回当前时刻与给定上下文关联参数的值,可以在SQL和PLSQL语言中使用。

提供以下命名空间:
Expand All @@ -16,8 +16,8 @@ IvorySQL提供兼容Oracle内置函数`SYS_CONTEXT('namespace', 'parameter' [, l

== 实现原理

SYS_CONTEXT的实现原理是通过动态查询系统表与postgres的内置函数,确保结果的实时性,
使用 SECURITY INVOKER 确保函数以调用者的权限执行,避免权限提升问题。
`SYS_CONTEXT` 的实现原理是通过动态查询系统表与postgres的内置函数,确保结果的实时性,
使用 `SECURITY INVOKER` 确保函数以调用者的权限执行,避免权限提升问题。
该方法的实现逻辑如下:
```sql
CREATE OR REPLACE FUNCTION sys.sys_context(a varchar2, b varchar2)
Expand Down
4 changes: 2 additions & 2 deletions CN/modules/ROOT/pages/master/6.4.2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

= **功能概述**

IvorySQL提供兼容Oracle内置函数`USERENV('parameter')`,用于返回当前会话的相关信息。
这是一个遗留函数,建议使用 SYS_CONTEXT 函数及其内置的 USERENV 命名空间来获取当前功能。
IvorySQL提供兼容Oracle内置函数 ```USERENV('parameter')``` ,用于返回当前会话的相关信息。
这是一个遗留函数,建议使用 `SYS_CONTEXT` 函数及其内置的 `USERENV` 命名空间来获取当前功能。

== 实现原理

Expand Down
1 change: 1 addition & 0 deletions EN/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
** xref:master/5.4.adoc[pg_cron]
** xref:master/5.5.adoc[pgsql-http]
** xref:master/5.6.adoc[plpgsql_check]
** xref:master/5.7.adoc[pgroonga]
* IvorySQL Architecture Design
** Query Processing
*** xref:master/6.1.1.adoc[Dual Parser]
Expand Down
1 change: 1 addition & 0 deletions EN/modules/ROOT/pages/master/5.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ IvorySQL, as an advanced open-source database compatible with Oracle and based o
| xref:master/5.4.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:master/5.5.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:master/5.6.adoc[plpgsql_check] | 2.8 | Provides static analysis functionality for PL/pgSQL code, can detect potential errors during development | Stored procedure development, code quality checking, debugging and optimization
| xref:master/5.7.adoc[pgroonga] | 4.0.4 | Provides full-text search functionality for non-English languages, meeting the needs of high-performance applications | Full-text search capabilities for languages like Chinese, Japanese, and Korean
|====

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.
Expand Down
91 changes: 91 additions & 0 deletions EN/modules/ROOT/pages/master/5.7.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
: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
[NOTE]
The PGroonga plugin is already included in the IvorySQL installation package. If you installed IvorySQL using the official released package, you typically do not need to manually install PGroonga and can skip the installation steps.

You can choose their preferred installation method for PGroonga from the https://pgroonga.github.io/install[PGroonga package installation] page.

The IvorySQL community provides source code installation steps, demonstrated below using PGroonga v4.0.4 as an example.

=== Dependencies

Setup Environment
```
Operating System: Ubuntu 24.04
CPU Architecture: x86_64
IvorySQL: v5.0
```
==== Install msgpack-c

When compile PGroonga, there is an option: `HAVE_MSGPACK=1`, which is used to support WAL. Enabling this option requires installing msgpack-c 1.4.1 or newer version.
```bash
sudo apt install libmsgpack-dev
```
==== Install Groonga

Ensure Groonga >= 14.0.0 is installed.
```bash
sudo apt install groonga libgroonga-dev
```
Verify Groonga installation:

```bash
highgo@ubuntu:~/work/IvorySQL/inst$ groonga --version
Groonga 15.1.7 [Linux,x86_64,utf8,match-escalation-threshold=0,nfkc,mecab,message-pack,mruby,onigmo,zlib,lz4,zstandard,epoll,apache-arrow,xxhash,blosc,h3,simdjson,llama.cpp]
```

=== Compile and Install PGroonga

==== Download and Extract the PGroonga Source Code

```bash
wget https://packages.groonga.org/source/pgroonga/pgroonga-4.0.4.tar.gz
tar xvf pgroonga-4.0.4.tar.gz
cd pgroonga-4.0.4
```
==== Compile

Before running make , ensure that the `pg_config` command is in the `PATH` environment variable. For example, if IvorySQL is installed at `~/work/IvorySQL/inst` , set the environment variables as follows:

```bash
export PGHOME=~/work/IvorySQL/inst
export PGDATA=$PGHOME/data
export PATH=$PGHOME/bin:$PATH
```
Then execute the following commands to compile and install:

```bash
make HAVE_MSGPACK=1
make install
```

== Create Extension PGroonga and Confirm the version

Connect to the database with `psql` in `pg` mode and execute the following commands:
```sql
postgres=# CREATE extension pgroonga;
CREATE EXTENSION
postgres=# SELECT * FROM pg_available_extensions WHERE name = 'pgroonga';
name | default_version | installed_version | comment
----------+-----------------+-------------------+--------------------------------------------------------------------------------
pgroonga | 4.0.4 | 4.0.4 | Super fast and all languages supported full text search index based on Groonga
(1 row)

postgres=# select version();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Chinese version, there is output of "select version()".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

version
--------------------------------------------------------------------------------
PostgreSQL (IvorySQL 5.0) 18.0 on x86_64-linux, compiled by gcc-13.3.0, 64-bit
(1 row)
```

== Usage
For PGroonga usage, please refer to the https://pgroonga.github.io/tutorial[PGroonga Official Documentation]
2 changes: 1 addition & 1 deletion EN/modules/ROOT/pages/master/6.4.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

= **Feature Overview**

IvorySQL provides compatibility with the Oracle built-in function `SYS_CONTEXT('namespace', 'parameter' [, length ])`,
IvorySQL provides compatibility with the Oracle built-in function ```SYS_CONTEXT('namespace', 'parameter' [, length ])```,
which returns the value of the parameter associated with the given context at the current moment. It can be used in both SQL and PL/SQL languages.

IvorySQL provides the following built-in namespaces:
Expand Down
2 changes: 1 addition & 1 deletion EN/modules/ROOT/pages/master/6.4.2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

= **Feature Overview**

IvorySQL provides compatibility with Oracle's built-in function `USERENV('parameter')`, which is used to return information about the current session.
IvorySQL provides compatibility with Oracle's built-in function ```USERENV('parameter')```, which is used to return information about the current session.
This is a legacy function, and IvorySQL recommends taht you can use the `SYS_CONTEXT` function with its built-in `USERENV` namespace for current functionality.

== Implementation Principle
Expand Down