|
| 1 | +:sectnums: |
| 2 | +:sectnumlevels: 5 |
| 3 | + |
| 4 | += PGroonga |
| 5 | + |
| 6 | +== Overview |
| 7 | +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. |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +== Installation |
| 12 | +[NOTE] |
| 13 | +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. |
| 14 | + |
| 15 | +You can choose their preferred installation method for PGroonga from the https://pgroonga.github.io/install[PGroonga package installation] page. |
| 16 | + |
| 17 | +The IvorySQL community provides source code installation steps, demonstrated below using PGroonga v4.0.4 as an example. |
| 18 | + |
| 19 | +=== Dependencies |
| 20 | + |
| 21 | +Setup Environment |
| 22 | +``` |
| 23 | + Operating System: Ubuntu 24.04 |
| 24 | + CPU Architecture: x86_64 |
| 25 | + IvorySQL: v5.0 |
| 26 | +``` |
| 27 | +==== Install msgpack-c |
| 28 | + |
| 29 | +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. |
| 30 | +```bash |
| 31 | + sudo apt install libmsgpack-dev |
| 32 | +``` |
| 33 | +==== Install Groonga |
| 34 | + |
| 35 | +Ensure Groonga >= 14.0.0 is installed. |
| 36 | +```bash |
| 37 | + sudo apt install groonga libgroonga-dev |
| 38 | +``` |
| 39 | +Verify Groonga installation: |
| 40 | + |
| 41 | +```bash |
| 42 | +highgo@ubuntu:~/work/IvorySQL/inst$ groonga --version |
| 43 | + 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] |
| 44 | +``` |
| 45 | + |
| 46 | +=== Compile and Install PGroonga |
| 47 | + |
| 48 | +==== Download and Extract the PGroonga Source Code |
| 49 | + |
| 50 | +```bash |
| 51 | + wget https://packages.groonga.org/source/pgroonga/pgroonga-4.0.4.tar.gz |
| 52 | + tar xvf pgroonga-4.0.4.tar.gz |
| 53 | + cd pgroonga-4.0.4 |
| 54 | +``` |
| 55 | +==== Compile |
| 56 | + |
| 57 | +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: |
| 58 | + |
| 59 | +```bash |
| 60 | + export PGHOME=~/work/IvorySQL/inst |
| 61 | + export PGDATA=$PGHOME/data |
| 62 | + export PATH=$PGHOME/bin:$PATH |
| 63 | +``` |
| 64 | +Then execute the following commands to compile and install: |
| 65 | + |
| 66 | +```bash |
| 67 | + make HAVE_MSGPACK=1 |
| 68 | + make install |
| 69 | +``` |
| 70 | + |
| 71 | +== Create Extension PGroonga and Confirm the version |
| 72 | + |
| 73 | +Connect to the database with `psql` in `pg` mode and execute the following commands: |
| 74 | +```sql |
| 75 | +postgres=# CREATE extension pgroonga; |
| 76 | +CREATE EXTENSION |
| 77 | +postgres=# SELECT * FROM pg_available_extensions WHERE name = 'pgroonga'; |
| 78 | + name | default_version | installed_version | comment |
| 79 | +----------+-----------------+-------------------+-------------------------------------------------------------------------------- |
| 80 | + pgroonga | 4.0.4 | 4.0.4 | Super fast and all languages supported full text search index based on Groonga |
| 81 | +(1 row) |
| 82 | +
|
| 83 | +postgres=# select version(); |
| 84 | + version |
| 85 | +-------------------------------------------------------------------------------- |
| 86 | + PostgreSQL (IvorySQL 5.0) 18.0 on x86_64-linux, compiled by gcc-13.3.0, 64-bit |
| 87 | +(1 row) |
| 88 | +``` |
| 89 | + |
| 90 | +== Usage |
| 91 | +For PGroonga usage, please refer to the https://pgroonga.github.io/tutorial[PGroonga Official Documentation] |
0 commit comments