# pgAI: PostgreSQL의 인공지능 기능을 위한 확장 (feat. Timescale)

**URL:** <https://discuss.pytorch.kr/t/pgai-postgresql-feat-timescale/6133>\
**Category:** 읽을거리&정보공유\
**Tags:** rag, vector-rag, pgai, vector-db, postgresql, pgvector, timescale\
**Created:** [2월 17, 2025, 3:30오전 UTC](https://discuss.pytorch.kr/t/pgai-postgresql-feat-timescale/6133 "2025-02-17T03:30:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![9bow](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/9bow/32/16301_2.png) [@9bow](https://discuss.pytorch.kr/u/9bow)\
**Post date:** [2월 17, 2025, 3:30오전 UTC](https://discuss.pytorch.kr/t/pgai-postgresql-feat-timescale/6133/1 "2025-02-17T03:30:45Z")

</div>

![pgAI: PostgreSQL의 인공지능 기능을 위한 확장 모듈(extension)](https://discuss.pytorch.kr/uploads/default/original/2X/b/bbee5a6dac72cdfc538202d61071c5d79c5b0803.png)

## pgAI 소개

[pgAI](https://github.com/timescale/pgai)는 PostgreSQL에 AI 기능을 추가할 수 있는 확장(extension) 모듈입니다. 이 확장 모듈을 활용하면 벡터 임베딩을 자동으로 생성하고, SQL에서 직접 의미 기반 검색을 수행할 수 있으며, LLM을 호출하여 Retrieval Augmented Generation(RAG)과 같은 작업을 수행할 수도 있습니다. 특히, OpenAI, Ollama, Cohere 등의 다양한 모델을 SQL 쿼리로 간편하게 호출할 수 있어 개발자가 별도의 API를 직접 호출하지 않아도 되는 점이 특징입니다.

![](https://img.youtube.com/vi/ZoC2XYol6Zk/maxresdefault.jpg)https://www.youtube.com/embed/ZoC2XYol6Zk?feature=oembed&wmode=opaque

pgAI가 제공하는 기능들은 다음과 같습니다:

- **벡터 임베딩 자동 생성 및 동기화** : 데이터 변경이 발생할 때 자동으로 벡터를 업데이트하여 최신 상태 유지

- **벡터 및 의미 기반 검색 (Vector & Semantic Search) 지원**: pgvector 및 pgvectorscale을 활용하여 빠르고 확장 가능한 벡터 검색 가능

- **Retrieval Augmented Generation(RAG) 지원**: SQL 내에서 AI 모델을 호출하여 문서 기반의 질문 응답 가능

- **SQL에서 직접 LLM 호출 가능** : OpenAI, Ollama, Cohere 등 다양한 AI 모델을 SQL 쿼리로 호출

PostgreSQL의 안정성과 확장성을 그대로 유지하면서 AI 모델을 활용할 수 있기 때문에 AI 기반 검색 시스템, 챗봇, 데이터 분석 등 다양한 분야에서 활용이 가능합니다.

## pgAI 확장의 주요 기능

 ![pgAI 포지셔닝 개요](https://discuss.pytorch.kr/uploads/default/original/2X/8/8a870bb8568c3c0935d7e6d0e745db20346bccb0.png)

1. **벡터 임베딩 자동 생성 및 동기화** : 기존 데이터베이스에 텍스트 데이터를 저장하면, pgAI는 이를 자동으로 벡터화하여 벡터 테이블에 저장합니다. 데이터가 변경될 경우 벡터 임베딩도 자동으로 업데이트됩니다.

2. **벡터 및 의미 기반 검색** : 벡터 검색을 활용하여 의미적으로 유사한 문서를 찾을 수 있습니다.

3. **Retrieval Augmented Generation(RAG)**: SQL 내에서 AI 모델을 활용하여 데이터를 검색하고 요약할 수 있습니다.

4. **다양한 AI 모델 지원** : pgAI는 여러 LLM 모델을 지원하며, SQL에서 직접 호출할 수 있습니다.

## 라이선스

pgAI 프로젝트는 [PostgreSQL 라이선스](https://github.com/timescale/pgai/blob/main/LICENSE)로 공개되어 있습니다. 사용 / 복사 / 수정 및 배포가 자유롭게 허용되나, 제작자는 이 소프트웨어의 사용으로 발생하는 어떠한 손실에 대해서도 책임지지 않으며, 유지보수나 지원/업데이트 제공 등의 의무가 없습니다. 자세한 내용은 [라이선스 원문](https://github.com/timescale/pgai/blob/main/LICENSE)을 참고해주세요.

## :github: pgAI GitHub 저장소

[https://github.com/timescale/pgai](https://github.com/timescale/pgai)

## 📜 Timescale의 pgAI 소개 글

> **[Pgai: Giving PostgreSQL Developers AI Engineering Superpowers](https://www.tigerdata.com/blog/pgai-giving-postgresql-developers-ai-engineering-superpowers)**
>
> Introducing pgai, a new open-source Postgres extension that brings embedding and generation models closer to the database.

## 📚 pgAI 사용을 위한 문서 모음

> **[pgai/docs at main · timescale/pgai](https://github.com/timescale/pgai/tree/main/docs)**
>
> A suite of tools to develop RAG, semantic search, and other AI applications more easily with PostgreSQL - timescale/pgai

### **빠른 시작 가이드**

- [Ollama와 함께하는 빠른 시작](https://github.com/timescale/pgai?tab=readme-ov-file#quick-start)

- [OpenAI 빠른 시작](https://github.com/timescale/pgai/blob/main/docs/vectorizer/quick-start-openai.md)

- [VoyageAI 빠른 시작](https://github.com/timescale/pgai/blob/main/docs/vectorizer/quick-start-voyage.md)

### **pgAI 벡터라이저 관련 튜토리얼**

- [PostgreSQL에서 SQL 한 줄로 자동 임베딩 생성 및 업데이트하는 방법 (블로그)](https://www.timescale.com/blog/how-to-automatically-create-update-embeddings-in-postgresql/)

- [SQL 한 줄로 벡터 임베딩을 자동 생성 및 동기화하기 (동영상)](https://www.youtube.com/watch?v=ZoC2XYol6Zk)

- [RAG 앱에서 가장 적합한 OpenAI 임베딩 모델은? (블로그)](https://www.timescale.com/blog/which-openai-embedding-model-is-best/)

- [pgvector 기반 RAG 시스템에서 최적의 청킹 및 포맷 전략은? (블로그)](https://www.timescale.com/blog/which-rag-chunking-and-formatting-strategy-is-best/)

- [오픈소스 도구를 활용한 데이터 파싱: Unstructured와 pgAI (블로그)](https://www.timescale.com/blog/parsing-all-the-data-with-open-source-tools-unstructured-and-pgai/)

### **pgAI 모델 호출 관련 튜토리얼**

- [데이터베이스 내 AI 에이전트: Claude를 활용한 툴 사용 (블로그)](https://www.timescale.com/blog/in-database-ai-agents-teaching-claude-to-use-tools-with-pgai/)

- [Cohere와 pgAI를 활용한 검색 및 RAG 시스템 구축 (블로그)](https://www.timescale.com/blog/build-search-and-rag-systems-on-postgresql-using-cohere-and-pgai/)

- [Ollama와 pgAI를 활용한 오픈소스 LLM 사용하기 (블로그)](https://www.timescale.com/blog/use-open-source-llms-in-postgresql-with-ollama-and-pgai/)

* * *

_이 글은 GPT 모델로 정리한 글을 바탕으로 한 것으로, 원문의 내용 또는 의도와 다르게 정리된 내용이 있을 수 있습니다. 관심있는 내용이시라면 원문도 함께 참고해주세요! 읽으시면서 어색하거나 잘못된 내용을 발견하시면 덧글로 알려주시기를 부탁드립니다._ 🤗

[:pytorch:파이토치 한국 사용자 모임🇰🇷](https://pytorch.kr/)이 정리한 이 글이 유용하셨나요? [회원으로 가입](https://discuss.pytorch.kr/signup)하시면 주요 글들을 이메일💌로 보내드립니다! (기본은 Weekly지만 [Daily로 변경도 가능](https://discuss.pytorch.kr/my/preferences/emails)합니다.)

🎁 아래↘쪽에 좋아요👍를 눌러주시면 새로운 소식들을 정리하고 공유하는데 힘이 됩니다~ 🤩

---

<div class="post-metadata">

**Author:** ![coyai](https://discuss.pytorch.kr/letter_avatar_proxy/v4/letter/c/22d042/32.png) [@coyai](https://discuss.pytorch.kr/u/coyai)\
**Post date:** [2월 17, 2025, 8:11오전 UTC](https://discuss.pytorch.kr/t/pgai-postgresql-feat-timescale/6133/2 "2025-02-17T08:11:42Z")

</div>

DB개발에서 수많은 사람들이 SQL 문법에 좌절하는데 좋은 소식이네요. SQL은 별거 아닌데 상당히 까다롭는데 이제 인공지능이 이걸 해결하면 전체 시스템 개발에 빠르게 많은 도움이 될것 같네요,

---

<div class="post-metadata">

**Author:** ![9bow](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/9bow/32/16301_2.png) [@9bow](https://discuss.pytorch.kr/u/9bow)\
**Post date:** [2월 17, 2025, 9:31오전 UTC](https://discuss.pytorch.kr/t/pgai-postgresql-feat-timescale/6133/3 "2025-02-17T09:31:28Z")

</div>

네네 VectorDB뿐만 아니라 RDBMS들에도 Text2SQL을 포함하여 점점 더 많은 기능들이 들어가고 있어 관심도 가고 걱정도 되고(?) 하네요 😅
