MSVBase는 스칼라 및 벡터 데이터 세트에서 대략적인 유사성 검색 및 관계형 운영자를 모두 포함하는 복잡한 온라인 쿼리를 효율적으로 서비스 할 수있는 새로운 시스템입니다. MSVBase는 스칼라 및 벡터 데이터 모두에서 광범위한 쿼리를 지원하기 위해 통합 쿼리 실행 엔진을 구축하고 우수한 쿼리 성능과 정확도를 보여줍니다. 최소한의 코드 수정으로 고차원 벡터 지수를 PostgreSQL에 통합합니다.
git clone https://github.com/microsoft/MSVBASE.git
cd MSVBASE
git submodule update --init --recursive
./scripts/patch.sh
./scripts/dockerbuild.sh
./scripts/dockerrun.sh
L2 및 내부 제품의 벡터 거리 계산을 지원하는 PostgreSQL 구문 및 프로토콜과 호환됩니다. 또한 HNSW 및 SPTAG 지수를 지원합니다. 곧, 우리는 Spann과 더 많은 지수를 통합 할 것입니다.
docker exec -it --privileged --user=root vbase_open_source bash
psql -U vectordb
벡터 데이터에 대한 쿼리 지원을 확장하면서 PostgreSQL의 모든 기능을 유지합니다.
create table t_table(id int, price int, vector_1 float8[10], vector_2 float8[10]);
insert into t_table values(1, 10, '{1,2,3,4,5,6,7,8,9,0}', '{5,6,7,1,2,3,4,8,9,1}');
copy t_table from 'your_data_path.tsv' DELIMITER E't' csv quote e'x01';
create index vector_index_1 on t_table using hnsw(vector_1) with(dimension=10,distmethod=l2_distance);
create index vector_index_2 on t_table using sptag(vector_2 vector_inner_product_ops) with(distmethod=inner_product);
select id from t_table order by vector_1 <-> '{5,9,8,6,2,1,1,0,4,3}' limit 10;
select id from t_table order by vector_2 <*> '{5,9,8,6,2,1,1,0,4,3}' limit 5;
select id from t_table where price > 15 order by vector_1 <-> '{5,9,8,6,2,1,1,0,4,3}' limit 10;
select id from t_table where price > 15 order by vector_2 <*> '{5,9,8,6,2,1,1,0,4,3}' limit 5;
select id from t_table where price > 15 and vector_1 <<->> '{30,5,9,8,6,2,1,1,0,4,3}';
select id from t_table
order by approximate_sum('0.5 * vector_1<->{5,9,8,6,2,1,1,0,4,3} + vector_2<*>{5,9,8,6,2,1,1,0,4,3}' ) limit 5;
select t_table.id as tid, d_table.id as did
from t_table join d_table
on t_table.vector_2 <<*>> array_cat(ARRAY[cast(10 as float8)], d_table.vector_2);
create database test;
c test;
create extension vectordb;
create table t_table(id int, price int, vector_1 float8[10]);
insert into t_table values(1, 10, '{1,2,3,4,5,6,7,8,9,0}');
insert into t_table values(2, 20, '{5,6,7,1,2,3,4,8,9,1}');
insert into t_table values(3, 30, '{9,8,7,6,5,4,3,2,1,0}');
create index t4_index on t_table using hnsw(vector_1) with(dimension=10,distmethod=l2_distance);
set enable_seqscan=false;
select id from t_table where price > 15 order by vector_1 <-> '{5,9,8,6,2,1,1,0,4,3}' limit 1;
insert into t_table values(4, 40, '{19,18,17,16,15,14,13,12,11,10}');
delete from t_table where id = 2;
이 프로젝트는 기여와 제안을 환영합니다. 대부분의 기부금은 귀하가 귀하가 귀하의 기부금을 사용할 권리를 부여 할 권리가 있다고 선언하는 기고자 라이센스 계약 (CLA)에 동의해야합니다. 자세한 내용은 https://cla.opensource.microsoft.com을 방문하십시오.
풀 요청을 제출할 때 CLA 봇은 CLA를 제공하고 PR을 적절하게 장식 해야하는지 자동으로 결정합니다 (예 : 상태 점검, 댓글). 봇이 제공 한 지침을 따르십시오. CLA를 사용하여 모든 저장소에서 한 번만이 작업을 수행하면됩니다.
이 프로젝트는 Microsoft 오픈 소스 행동 강령을 채택했습니다. 자세한 내용은 추가 질문이나 의견이 있으면 행동 강령 FAQ 또는 [email protected]에 문의하십시오.
이 프로젝트에는 프로젝트, 제품 또는 서비스에 대한 상표 또는 로고가 포함될 수 있습니다. Microsoft 상표 또는 로고의 승인 된 사용에는 Microsoft의 상표 및 브랜드 지침이 적용되며 따라야합니다. 이 프로젝트의 수정 된 버전에서 Microsoft 상표 또는 로고를 사용한다고해서 혼란을 일으키거나 Microsoft 후원을 암시해서는 안됩니다. 타사 상표 또는 로고를 사용하면 타사 정책이 적용됩니다.