脱掉三件马甲之后,VexDB露出PG心
脱掉三件马甲之后,VexDB露出PG心
VexDB到底什么来头? 最初我猜想和PostgreSQL或openGauss有关, 拿到鲲鹏920架构的免费安装包可以轻松在mac M芯片的机器上用debian:12的容器拉起来. ( 鲲鹏920和Apple M2芯片兼容? )
安装仅参考了vexdb的官方文档, 几乎没有踩坑比较顺畅, 遇到几个小问题都用阿里云的Qwen3 Max解决了.
https://chat.qwen.ai/
结果印证了前面的猜想, 果然和PostgreSQL、openGauss都有关, 而且和海量vastbase有关.
有熟悉内幕的朋友可以继续补充.
下面是容器部署过程记录.
下载debian容器镜像
https://hub.docker.com/_/debian
docker pull debian:12
创建容器
在宿主机创建2个volume目录, 用于存放实例data文件. 另一个bak目录为空, 临时文件、下载的源代码等可以存放于此, 区别于vexdb实例的数据目录.
mkdir -p ~/docker_vexdb/data
mkdir -p ~/docker_vexdb/bak
配置几个变量, 创建容器
cd ~/docker_vexdb/data
PG_DATA=`pwd`
cd ~/docker_vexdb/bak
BAK_DIR=`pwd`
docker run -d -it -p 0.0.0.0:1922:5432 --add-host=host.docker.internal:host-gateway \
-u root -w /root -e LANG=en_US.utf8 \
-v $BAK_DIR:/vexdb/bak \
-v $PG_DATA:/vexdb/data \
--cap-add=SYS_PTRACE --cap-add SYS_ADMIN --privileged=true --shm-size=1g \
--name vexdb debian:12
说明:
5432是vexdb数据库默认监听端口.-p 1922:5432表示将容器内的5432端口映射到宿主机的1922端口, 在宿主机上可通过127.0.0.1:1922访问容器中的数据库.--add-host=host.docker.internal:host-gateway让B容器可通过host.docker.internal域名访问A容器映射到宿主机的端口, 解决B容器有访问A容器内数据库的需求!从容器内访问宿主机, 采用域名: host.docker.internal
进入容器, 配置root用户bash环境变量
docker exec -ti vexdb bash
echo"alias ll='ls -larth'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'" >> /root/.bashrc
# 使环境变量生效
. /root/.bashrc
安装依赖包
使用阿里云debian bookworm apt镜像源
echo"# Debian 12 Bookworm 阿里云镜像源
deb http://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware
deb-src http://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware
deb http://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src http://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware
deb http://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src http://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware
deb http://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src http://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware" > /etc/apt/sources.list
mv /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list.d/debian.sources.bak
安装vexdb依赖包
apt-get update && apt-get install -y \
ca-certificates libreadline8 zlib1g libxml2 libaio1 libncurses6 gettext \
libaio1 libaio-dev libuuid1 uuid-dev libkrb5-3 libicu72 libxslt1.1 tcl perl libldap-2.5-0 libldap2-dev \
libpam0g libpam0g-dev bzip2 libbz2-1.0 libbz2-dev zlib1g-dev libreadline-dev libssl-dev vim locales less
配置时区
覆盖时区文件
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
初始化locales, 必选es_US.UTF-8
dpkg-reconfigure locales
120. es_US.UTF-8 UTF-8
...
Locales to be generated: 120 // 选择 es_US.UTF-8 UTF-8
Many packages in Debian use locales to display text in the correct language for the user. You can choose a default locale for the system from the generated locales.
This will select the default language for the entire system. If this system is a multi-user system where not all users are able to speak the default language, they will experience difficulties.
1. None 2. C.UTF-8 3. es_US.UTF-8
Default locale for the system environment: 3 // 选择 es_US.UTF-8
Generating locales (this might take a while)...
es_US.UTF-8... done
Generation complete.
下载vexdb软件
https://vexdb.com/download
根据CPU架构下载对应软件版本
拷贝到容器内
docker cp VexDB-Developer-Edition-3.0_Build0_28146-Linux-kunpeng920-no_mot-202509011854.tar.gz vexdb:/vexdb/bak/
# 或直接放入宿主机目录 ~/docker_vexdb/bak
安装vexdb软件, 初始化实例
在容器中解压软件包
# cd /vexdb/bak/
# tar -zxvf VexDB-Developer-Edition-3.0_Build0_28146-Linux-kunpeng920-no_mot-202509011854.tar.gz
包内内容如下:
vexdb-installer/
vexdb-installer/vexdb_installer
vexdb-installer/locales/
vexdb-installer/locales/messages.en-US.json
vexdb-installer/locales/messages.zh-CN.json
vexdb-installer/VexDB-Developer-Edition-3.0_Build0_28146-Linux-kunpeng920-no_mot.tar.gz
vexdb-installer/.checksum
创建vexdb OS用户
useradd -m -s /bin/bash vexdb
修改软件包目录的owner和权限
# chown -R vexdb:vexdb /vexdb/bak/vexdb-installer
# chmod -R 775 /vexdb/bak/vexdb-installer
进入vexdb OS用户, 交互安装vexdb软件, 并初始化实例
su - vexdb
环境变量
echo"alias ll='ls -larth'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'" >> /home/vexdb/.bashrc
# 使环境变量生效
. /home/vexdb/.bashrc
调用vexdb_installer开始交互安装
cd /vexdb/bak/vexdb-installer/
./vexdb_installer
交互日志如下
有些日志可以忽略, 例如debian 12不使用selinux, 所以有告警
===============================================================================
Welcome to the installation tool (V1.0) and start installing VexDB.
===============================================================================
Check whether the installation package is complete
---------------
ok
===============================================================================
Type <Enter> to continue:
===============================================================================
System configuration information
---------------
Operation System : Debian GNU/Linux 12 (bookworm)
Memory size : 7937 MB
Current user name: vexdb
Type <Enter> to continue:
===============================================================================
Dependency check
---------------
libreadline : 8.2-1.3
zlib1g : 1:1.2.13.dfsg-1
gettext : 0.21-12
libaio1 : 0.3.113-4
libncurses : 6.4-4
Type <Enter> to continue:
------------------
Preparing the installation environment...
Finish to prepare the installation environment
===============================================================================
IPC parameter check
---------------
The IPC parameter check is complete
Failed to find sestatus: , exit status 1 // debian 12不使用selinux, 所以有告警
===============================================================================
Install database
---------------
Whether to instantiate the database (Y/N): Y
Select installation type
Typical installation : Use default parameters to init database
Custom installation : Configure installation parameters and functions manually
-> 1- Typical installation
2- Custom installation
Select the installation type, or type <Enter> to select the default (1):
2 // 定制安装
===============================================================================
Database Initialization User Password (Press the backspace key to go back)
---------------
Enter the password of database initialization user (vexdb): ********* //输入 Vexdb@123
Please enter your password again: ********* //输入 Vexdb@123
===============================================================================
Database encryption key(PGENCRYPTIONKEY)
---------------
Set database encryption key(PGENCRYPTIONKEY):
-> 1- Use the database initialization password (default)
2- Enter the encryption key manually
Select the database encryption key setting, or type <Enter> to select the default(1):
===============================================================================
VexDB installation directory
---------------
VexDB installation directory
Default location: /home/vexdb/local/vexdb
Type the absolute path (ctrl+ backspace to backspace), or type <Enter> to use the default path :
// 软件目录保持默认地址
===============================================================================
Database initialization directory
---------------
Select the database initialization directory Default location: /home/vexdb/data/vexdb
Type the absolute path (ctrl+ backspace to backspace), or type <Enter> to use the default path :
// 数据库实例目录修改为 /vexdb/data
/vexdb/data
===============================================================================
listener port
---------------
Enter the listening port, or type <Enter> to select the default (5432):
// 监听端口保持不变
===============================================================================
Max Connections
---------------
Enter the maximum number of client connections, or type <Enter> to select the default (500):
===============================================================================
Shared buffers
---------------
Enter the shared memory size in MB, or enter <Enter> to select the default (1984):
// shared buffer修改为 1024, 后来发现还是太大了, 通过修改postgresql.conf可配置
1024
===============================================================================
Check disk IO scheduling algorithm
---------------
// 忽略IO调度策略的告警
The disk IO scheduling algorithm to which directory /vexdb/data belongs is being checked
WARNING: The disk IO scheduling algorithm fails to be viewed, and the disk I0 scheduling algorithm check exits. The failed command is as follows:
cat /sys/block//queue/scheduler| grep -o '\[.*\]'
ERROR: cat: /sys/block//queue/scheduler: No existe el fichero o el directorio
WARNING: The disk IO scheduling algorithm fails to be checked. Please manually check whether the disk where the database data directory resides has an I0 scheduling algorithm of "deadline". If not, you are advised to change it to "deadline".
===============================================================================
Installation summary
---------------
VexDB installation directory:
/home/vexdb/local/vexdb
VexDB directory:
/vexdb/data
Database initialization user :
vexdb
Database initialization parameter :
listen_addresses='*'
port=5432
max_connections=500
shared_buffers=1024MB
max_process_memory=5278MB
work_mem=4MB
Type <Enter> to continue:
Installation underway, please wait...
Initialize database successfully, data directory :/vexdb/data
// 这里有几个初始用户的密码
The default passwords of the three default database administrators vbaudit, vbsso, and vbadmin are:
system admin[vbadmin] initial password: U1/6ce5b
security admin[vbsso] initial password: F_3bb395
audit admin[vbaudit] initial password: Ue/c7c70
Generate the encryption key file
The encryption key file is generated successfully
The configuration file /vexdb/data/postgresql.conf was successfully updated
Writing configuration file
Writing cluster_config.xml file
Writing environment variables
The configuration file:'/home/vexdb/.bashrc' is successfully updated
===============================================================================
Loading an Official license
---------------
Whether to load an official license (Y/N): N
// 无需配置license文件, 因为是免费版.
===============================================================================
Installation complete
---------------
Specify the license path first (if the license path is incorrect, the database fails to start):
Write the license path to file /vexdb/data/postgresql.conf in the form of license_path='license path'
To initialize the database running environment:
source ~/.bashrc
To start, stop, and restart the database:
vb_ctl <start/stop/restart>
If the installation is complete, Enter <Enter> to exit:
应用环境变量
source ~/.bashrc
查看psql/vsql是否可用
$ psql -V
vsql (VexDB Developer Edition V3.0 Release) compiled at 2025-09-01 19:02:46 commit 28146 last mr
$ vsql -V
vsql (VexDB Developer Edition V3.0 Release) compiled at 2025-09-01 19:02:46 commit 28146 last mr
发现gauss痕迹
查看一下环境变量文件, 发现了gauss关键字.
tail -n 1 ~/.bashrc
source /home/vexdb/.VexDB
vexdb@a456c975ebd0:~$ cat /home/vexdb/.VexDB
export PGPORT=5432
export PGUSER=vexdb
export PGDATA=/vexdb/data
export LD_LIBRARY_PATH=/home/vexdb/local/vexdb/jre/lib/aarch64:/home/vexdb/local/vexdb/jre/lib/aarch64/server:$LD_LIBRARY_PATH
export GAUSSHOME=/home/vexdb/local/vexdb
export PATH=/home/vexdb/local/vexdb/bin:$PATH
export OM_GPHOME=/home/vexdb/local/omTmp
export LD_LIBRARY_PATH=$OM_GPHOME/lib:$LD_LIBRARY_PATH
export PATH=$OM_GPHOME/script/gspylib/pssh/bin:$OM_GPHOME/script:$PATH
export PYTHONPATH=$OM_GPHOME/lib
export OM_GAUSS_VERSION=3.0.0
export OM_PGHOST=/home/vexdb/local/omTmp/tmp
export OM_GAUSSLOG=/vexdb/data/pg_log
export OM_GAUSS_ENV=2
export OM_GS_CLUSTER_NAME=dbCluster
启动实例
vexdb@a456c975ebd0:/vexdb/data$ vb_ctl start -D /vexdb/data
遇到报错, max_process_memory 配置小了.
2025-09-25 14:39:06.647 [unknown] [unknown] localhost 281473441562656 0[0:0#0] 0 [BACKEND] FATAL: the values of memory out of limit, the database failed to be started, max_process_memory (5767MB) must greater than 2GB + cstore_buffers(512MB) + (udf_memory_limit(200MB) - UDF_DEFAULT_MEMORY(200MB)) + shared_buffers(512MB) + preserved memory(2695MB) = 5767MB, reduce the value of shared_buffers, max_pred_locks_per_transaction, max_connection, wal_buffers, max_wal_senders, wal_receiver_buffer_size..etc will help reduce the size of preserved memory
修改 postgresql.conf , 调大 max_process_memory , 缩小 shared_buffers
vi /vexdb/data/postgresql.conf
shared_buffers=512MB
max_process_memory=6767MB
重新启动即可
vexdb@a456c975ebd0:/vexdb/data$ vb_ctl start -D /vexdb/data
发现opengauss和vastbase痕迹
$ cd /vexdb/data/
vexdb@a456c975ebd0:/vexdb/data$ ll
total 4.8M
drwxr-xr-x 4 root root 4.0K sep 25 13:48 ..
drwx------ 2 vexdb vexdb 64 sep 25 14:32 pg_serial
drwx------ 2 vexdb vexdb 64 sep 25 14:32 pg_snapshots
drwx------ 2 vexdb vexdb 64 sep 25 14:32 pg_twophase
drwx------ 4 vexdb vexdb 128 sep 25 14:32 pg_multixact
drwx------ 2 vexdb vexdb 64 sep 25 14:32 pg_replslot
drwx------ 2 vexdb vexdb 64 sep 25 14:32 pg_tblspc
drwx------ 4 vexdb vexdb 128 sep 25 14:32 pg_llog
drwx------ 2 vexdb vexdb 64 sep 25 14:32 pg_errorinfo
drwx------ 2 vexdb vexdb 64 sep 25 14:32 pg_location
-rw------- 1 vexdb vexdb 4 sep 25 14:32 PG_VERSION
-rw------- 1 vexdb vexdb 1.0K sep 25 14:32 postgresql.conf.lock
-rw------- 1 vexdb vexdb 354 sep 25 14:32 gs_gazelle.conf
-rw------- 1 vexdb vexdb 1.6K sep 25 14:32 pg_ident.conf
-rw------- 1 vexdb vexdb 0 sep 25 14:32 postmaster.pid.lock
drwx------ 3 vexdb vexdb 96 sep 25 14:32 pg_clog
drwx------ 3 vexdb vexdb 96 sep 25 14:32 pg_csnlog
-rw------- 1 vexdb vexdb 1 sep 25 14:33 VB_COMPATIBILITY
drwx------ 7 vexdb vexdb 224 sep 25 14:33 pg_xlog
-rw------- 1 vexdb vexdb 4.4K sep 25 14:33 pg_hba.conf
-rw------- 1 vexdb vexdb 42K sep 25 14:39 postgresql.conf
-rw------- 1 vexdb vexdb 0 sep 25 14:39 pg_ctl.lock
-rw------- 1 vexdb vexdb 65 sep 25 14:39 postmaster.pid
drwx------ 3 vexdb vexdb 96 sep 25 14:39 pg_notify
-rw------- 1 vexdb vexdb 53 sep 25 14:39 postmaster.opts
drwx------ 131 vexdb vexdb 4.1K sep 25 14:39 global
-rw------- 1 vexdb vexdb 4.7M sep 25 14:39 gswlm_userinfo.cfg
drwx------ 9 vexdb vexdb 288 sep 25 14:39 pg_log
drwx------ 6 vexdb vexdb 192 sep 25 14:39 undo
-rw------- 1 vexdb vexdb 72 sep 25 14:39 gaussdb.state
drwx------ 34 vexdb vexdb 1.1K sep 25 14:39 .
drwx------ 8 vexdb vexdb 256 sep 25 14:50 base
drwx------ 3 vexdb vexdb 96 sep 25 15:03 pg_logical
drwx------ 3 vexdb vexdb 96 sep 25 15:03 pg_stat_tmp
$ grep -i gauss postgresql.conf
# values can be found in the openGauss documentation.
# - Previous openGauss Versions -
$ grep -i vastbase postgresql.conf
vastbase_login_info = off #login info
# vastbase_sql_mode='ANSI_QUOTES,pipes_as_concat,pad_char_to_full_length,sql_mode_strict,no_zero_date,error_for_division_by_zero'
vastbase_login_info = off
使用psql客户端连接vexdb
psql -U vexdb postgres
psql ((VexDB Developer Edition V3.0 Release) compiled at 2025-09-01 19:02:46 commit 28146 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help"forhelp.
postgres=#
postgres=# select version();
version
------------------------------------------------------------------------------------
PostgreSQL 9.2.4 on aarch64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit
(1 row)
postgres=# \l+
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description
-----------+-------+----------+-------------+-------------+-------------------+-------+------------+--------------------------------------------
postgres | vexdb | UTF8 | es_US.UTF-8 | es_US.UTF-8 | | 27 MB | pg_default |
template0 | vexdb | UTF8 | es_US.UTF-8 | es_US.UTF-8 | =c/vexdb +| 27 MB | pg_default | default template for new databases
| | | | | vexdb=CTc/vexdb | | |
template1 | vexdb | UTF8 | es_US.UTF-8 | es_US.UTF-8 | =c/vexdb +| 27 MB | pg_default | unmodifiable empty database
| | | | | vexdb=CTc/vexdb | | |
vastbase | vexdb | UTF8 | es_US.UTF-8 | es_US.UTF-8 | | 27 MB | pg_default | default administrative connection database
(4 rows)
postgres=# \du+
List of roles
Role name | Attributes | Member of | Description
----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+-------------
vb_read_all_settings | Cannot login, Monitoradmin, Operatoradmin, Policyadmin | {} |
vbadmin | Superuser, Create role, Create DB, Replication, Sysadmin, UseFT | {} |
vbaudit | Create role, Administer audit, UseFT | {} |
vbsso | Create role, Administer sso | {} |
vexdb | Initialuser, Superuser, Create role, Create DB, Replication, Administer sso, Administer audit, Sysadmin, Monitoradmin, Operatoradmin, Policyadmin, UseFT | {} |
postgres=# \db+
List of tablespaces
Name | Owner | Location | Access privileges | Description
------------+-------+----------+-------------------+-------------
pg_default | vexdb | | |
pg_global | vexdb | | |
(2 rows)
在宿主机上可通过映射的1922端口连接容器中的vexdb
$ psql -h 127.0.0.1 -p 1922 -U r1 -d vexdb -W
Password:
psql (17.6, server 9.2.4)
Type "help"forhelp.
vexdb=> \du
List of roles
Role name | Attributes
-----------+------------
r1 |
vexdb=> select version();
version
------------------------------------------------------------------------------------
PostgreSQL 9.2.4 on aarch64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit
(1 row)
测试向量索引
参考文档:
postgres=# create role r1 login sysadmin encrypted password 'Vexdb@123';
CREATE ROLE
postgres=# create database vexdb with owner r1;
CREATE DATABASE
\c vexdb vexdb
vexdb=# CREATE OR REPLACE FUNCTION random_array(dim integer,min_value int, max_value int)
vexdb-# RETURNS text
vexdb-# AS $$
vexdb$# SELECT REGEXP_REPLACE(REGEXP_REPLACE(array_agg(round(random()* (max_value - min_value + 1) + min_value,3))::text,'{','['),'}',']')
vexdb$# FROM generate_series(1, dim);
vexdb$# $$
vexdb-# LANGUAGE SQL
vexdb-# VOLATILE
vexdb-# COST 1;
CREATE FUNCTION
vexdb=#
vexdb=# drop table t_1194690;
ERROR: table "t_1194690" does not exist
vexdb=# CREATE TABLE t_1194690(id BIGINT, v floatVECTOR(15));
CREATE TABLE
vexdb=# INSERT INTO t_1194690 SELECT i, random_array(15,1,3)::floatvector(15) FROM generate_series(1, 10000) AS i;
INSERT 0 10000
vexdb=#
vexdb=# CREATE INDEX idx_1194690a ON t_1194690 USING ivfpq(v floatvector_cosine_ops)WITH(ivf_nlist= 100, num_subquantizers=3,nbits=4,parallel_workers=1);
NOTICE: Kmeans finished: 329.51 ms
NOTICE: PQ train done: 100.45 ms
NOTICE: Scan Table finished: 12.52 ms
NOTICE: Build Index finished: 10.68 ms
NOTICE: Start logging index: 14.71 μs
NOTICE: Index logged: 243.67 μs
CREATE INDEX
vexdb=#
vexdb=# CREATE INDEX idx_1194690b ON t_1194690 USING ivfpq(v floatvector_l2_ops)WITH(ivf_nlist= 100, num_subquantizers=3,nbits=4,parallel_workers=1);
NOTICE: Kmeans finished: 296.36 ms
NOTICE: PQ train done: 102.89 ms
NOTICE: Scan Table finished: 13.21 ms
NOTICE: Build Index finished: 10.65 ms
NOTICE: Start logging index: 500 ns
NOTICE: Index logged: 172.62 μs
CREATE INDEX
vexdb=# CREATE INDEX idx_1194690c ON t_1194690 USING ivfpq(v floatvector_ip_ops)WITH(ivf_nlist= 100, num_subquantizers=3,nbits=4,parallel_workers=1);
NOTICE: Kmeans finished: 279.71 ms
NOTICE: PQ train done: 73.38 ms
NOTICE: Scan Table finished: 12.77 ms
NOTICE: Build Index finished: 10.02 ms
NOTICE: Start logging index: 9.75 μs
NOTICE: Index logged: 274.00 μs
CREATE INDEX
vexdb=# CREATE INDEX idx_1194690d ON t_1194690 USING ivfpq(v floatvector_ip_ops)WITH(num_subquantizers=3);
NOTICE: Kmeans finished: 179.31 ms
NOTICE: PQ train done: 455.65 ms
NOTICE: Scan Table finished: 6.10 ms
NOTICE: Build Index finished: 42.89 ms
NOTICE: Start logging index: 1.62 μs
NOTICE: Index logged: 361.62 μs
CREATE INDEX
vexdb=# set ivf_probes = 10;
SET
vexdb=# SELECT * FROM t_1194690
vexdb-# ORDER BY v <=> '[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]'::floatvector
vexdb-# LIMIT 10;
id | v
------+---------------------------------------------------------------------------------------------
273 | [3.065,3.173,3.216,2.529,3.89,3.535,3.166,3.096,3.092,2.406,2.086,2.825,2.387,2.102,2.056]
9883 | [3.072,3.188,1.575,2.885,3.361,2.211,2.758,3.625,3.704,2.059,2.391,2.893,3.439,2.742,3.434]
8392 | [3.516,3.238,2.842,2.535,3.289,2.107,2.975,3.148,2.008,2.144,3.112,1.503,3.887,3.624,3.081]
2170 | [2.815,3.886,3.424,2.053,1.792,2.745,3.089,2.834,2.429,2.615,2.078,3.84,2.475,1.928,2.5]
6189 | [2.845,3.865,3.679,2.761,2.249,2.205,2.682,2.117,2.494,3.272,3.483,3.785,3.569,3.052,1.393]
7943 | [3.352,3.481,2.074,3.239,3.486,1.754,3.35,2.268,1.9,1.772,2.598,3.565,3.695,2.844,2.675]
5100 | [3.996,2.805,1.896,2.894,3.404,3.195,3.776,3.061,2.562,3.277,2.53,2.468,1.108,3.366,2.136]
717 | [1.87,2.429,2.611,1.889,2.3,1.668,2.415,3.303,2.981,3.068,3.427,1.389,1.762,3.342,2.645]
3669 | [2.365,1.029,2.038,1.316,2.638,2.472,2.493,2.647,2.839,2.065,1.66,1.659,3.064,2.147,1.674]
8056 | [3.289,2.605,2.174,3.594,3.633,1.586,3.674,3.394,3.799,2.21,2.142,1.606,3.73,3.576,2.811]
(10 rows)
vexdb=#
vexdb=# \timing
Timing is on.
vexdb=# SELECT * FROM t_1194690
vexdb-# ORDER BY v <=> '[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]'::floatvector
vexdb-# LIMIT 10;
id | v
------+---------------------------------------------------------------------------------------------
273 | [3.065,3.173,3.216,2.529,3.89,3.535,3.166,3.096,3.092,2.406,2.086,2.825,2.387,2.102,2.056]
9883 | [3.072,3.188,1.575,2.885,3.361,2.211,2.758,3.625,3.704,2.059,2.391,2.893,3.439,2.742,3.434]
8392 | [3.516,3.238,2.842,2.535,3.289,2.107,2.975,3.148,2.008,2.144,3.112,1.503,3.887,3.624,3.081]
2170 | [2.815,3.886,3.424,2.053,1.792,2.745,3.089,2.834,2.429,2.615,2.078,3.84,2.475,1.928,2.5]
6189 | [2.845,3.865,3.679,2.761,2.249,2.205,2.682,2.117,2.494,3.272,3.483,3.785,3.569,3.052,1.393]
7943 | [3.352,3.481,2.074,3.239,3.486,1.754,3.35,2.268,1.9,1.772,2.598,3.565,3.695,2.844,2.675]
5100 | [3.996,2.805,1.896,2.894,3.404,3.195,3.776,3.061,2.562,3.277,2.53,2.468,1.108,3.366,2.136]
717 | [1.87,2.429,2.611,1.889,2.3,1.668,2.415,3.303,2.981,3.068,3.427,1.389,1.762,3.342,2.645]
3669 | [2.365,1.029,2.038,1.316,2.638,2.472,2.493,2.647,2.839,2.065,1.66,1.659,3.064,2.147,1.674]
8056 | [3.289,2.605,2.174,3.594,3.633,1.586,3.674,3.394,3.799,2.21,2.142,1.606,3.73,3.576,2.811]
(10 rows)
Time: 0.996 ms
vexdb=#
vexdb=# explain SELECT * FROM t_1194690
vexdb-# ORDER BY v <=> '[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]'::floatvector
vexdb-# LIMIT 10;
QUERY PLAN
-------------------------------------------------------------------------------------------------
Limit (cost=-10.42..-9.62 rows=10 width=40)
-> ANN Index Scan using idx_1194690a on t_1194690 (cost=-10.42..792.58 rows=10000 width=40)
Order By: (v <=> '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]'::floatvector)
(3 rows)
Time: 0.942 ms
vexdb=#
vexdb=# explain SELECT * FROM t_1194690
vexdb-# ORDER BY v <-> '[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]'::floatvector
vexdb-# LIMIT 10;
QUERY PLAN
-------------------------------------------------------------------------------------------------
Limit (cost=-10.42..-9.62 rows=10 width=40)
-> ANN Index Scan using idx_1194690b on t_1194690 (cost=-10.42..792.58 rows=10000 width=40)
Order By: (v <-> '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]'::floatvector)
(3 rows)
Time: 0.779 ms
vexdb=#
vexdb=# explain SELECT * FROM t_1194690
vexdb-# ORDER BY v <#> '[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]'::floatvector
vexdb-# LIMIT 10;
QUERY PLAN
-------------------------------------------------------------------------------------------------
Limit (cost=-10.57..-9.77 rows=10 width=40)
-> ANN Index Scan using idx_1194690d on t_1194690 (cost=-10.57..792.43 rows=10000 width=40)
Order By: (v <#> '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]'::floatvector)
(3 rows)
Time: 0.774 ms
vexdb=#
小结
整个安装使用过程从配置文件、默认数据库、version()返回等综合信息, 可看到从PostgreSQL 9.2.4到openGauss到vastbase再到VexDB一路演进的痕迹.
使用过程中, 只需要熟悉VexDB的向量、全文检索、重排等相关特性即可.
但在运维过程中, 还是要熟悉底层的PostgreSQL 9.2.4到openGauss到vastbase再到VexDB, 如果你本来就是og的用户那么恭喜你, 否则运维门槛可能会比较高.
不管马甲多少件, 我心依旧是PG心!
不管啥心, 技术层面关注的永远是好不好用、稳不稳定、可不可靠、性能怎么样, 商务层面关注的则是有没有兜底对吧!
你怎么看?