Extension - ai_image_search: Image Search Inside PostgreSQL

From: lakshmi <lakshmigcdac(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Extension - ai_image_search: Image Search Inside PostgreSQL
Date: 2026-09-17 06:30:17
Message-ID: CAEvyyTg52hG77qviWMHipCE1dE=jQ_F+DYhxed7QgrTrs4YF-A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello PostgreSQL Community,

I would like to share a PostgreSQL extension I have been working on, called
ai_image_search.

It lets you search images stored in your database by meaning rather than by
filename or tags. You can search using a text description, such as "a girl
wearing a tshirt", or by giving another image and finding the ones most
similar to it. The results are then reranked using a second model to improve
the ordering.

Everything runs inside PostgreSQL using plpython3u and pgvector. The
embeddings are stored in a normal column in your own table, so searching is
just a regular SQL query.

The main benefit is that you do not need a separate vector database or an
external service to do this. The images and their embeddings stay in the
same place, there is no extra infrastructure to maintain, and it works with
tables you already have.

I am attaching the code as a patch, along with a screenshot of the output.
from a sample run.

I would be glad to hear the community's thoughts on the approach and on
anything that could be improved.

Thank you
Regards,
Lakshmi

Attachment Content-Type Size
test.sql application/sql 6.4 KB
output_example.png image/png 229.8 KB
image/png 23.8 KB

Browse pgsql-general by date

  From Date Subject
Next Message Mark Hill 2026-09-17 20:24:36 Error Creating pgcrypto Extension
Previous Message 2026-09-16 15:35:15 Extract text from XML, pay attention to XML Entities