프로그래밍/DB

윈도우에서 postgreSQL 시작하기 - pgvector 윈도우 설치하기

kugancity 2024. 8. 20. 19:30
728x90
반응형

 

 

윈도우에서 pgvector 사용하기 

 

윈도우에서 pgvector를 설치하고 사용하는 과정을 기록해보겠습니다. 

 

 

 

 

https://github.com/pgvector/pgvector?tab=readme-ov-file

 

GitHub - pgvector/pgvector: Open-source vector similarity search for Postgres

Open-source vector similarity search for Postgres. Contribute to pgvector/pgvector development by creating an account on GitHub.

github.com

 

 

 

https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#download-and-install-the-tools

 

https://learn.microsoft.com/en-us/cpp/build/vscpp-step-0-installation?view=msvc-170

 

Install C and C++ support in Visual Studio

Learn how to install Visual Studio with support for Microsoft C/C++ and related workloads.

learn.microsoft.com

 

 

찾기에서 cmd를 입력해서 관리자 권한으로 명령 프롬프트를 실행합니다. 

 

 

 

call 은 비쥬얼스튜디오가 설치된 폴더와 PGROOT는 postgreSQL이 설치된 폴더로 변경합니다. 

 

call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"

set "PGROOT=C:\Program Files\PostgreSQL\16"
cd %TEMP%
git clone --branch v0.7.4 https://github.com/pgvector/pgvector.git
cd pgvector
nmake /F Makefile.win
nmake /F Makefile.win install

 

다 설치하고 발견했는데 docker로도 설치가 가능하네요... 

 

 

 

PgAdmin에서 pgvector 활성화


pgvector 확장이 서버에 설치된 후, PgAdmin을 사용하여 데이터베이스에 확장을 활성화할 수 있습니다. 

PgAdmin 열기: PgAdmin을 실행하고, PostgreSQL 서버에 연결합니다.

Query Tool 열기: 확장을 활성화하려는 데이터베이스를 선택하고 오른쪽 클릭한 후 Query Tool을 선택합니다.

확장 활성화 쿼리 실행

CREATE EXTENSION IF NOT EXISTS vector;


이 SQL 문을 실행하면 해당 데이터베이스에서 pgvector 확장이 활성화됩니다.

확인: 왼쪽 패널의 Extensions 아래에서 vector 확장이 활성화된 것을 확인할 수 있습니다.

 

 

pgadmin에서 pgvector 활성화하기

 

 

이제 테이블에서 칼럼 타입으로 vector를 선택 가능합니다. 

 

 

 

 

다음에는 pgvector에서 이어서 벡터 유사도 검색을 진행해보겠습니다. 

 

 

 

 

728x90
반응형