X · by Avi Chawla
Semantic database filters
Filter rows on questions a WHERE clause cannot express.
Avi Chawla
@_avichawla
Another insane Jev use case! Traditional database filters need precise, predefined conditions. But many questions are semantic: - Is this article mainly about software engineering? - Which topic best describes it? - How technically deep does it appear? These usually require moving rows into application code, invoking a model, parsing its output, and writing the result back. pg-jev is an open-source Postgres extension that exposes Jev through SQL functions. - jev() works inside WHERE - jev_prob() returns a probability - jev_choice() selects a label - jev_score() ranks rows across ordered levels. It needs no vector column or embedding index. Under the hood, pg-jev batches rows, sends them to Jev, and returns typed answers that SQL can filter, sort, group, and combine with exact predicates. The recording below runs it against real Hacker News stories stored in Postgres. It first shows the rows, then asks Jev to find software-engineering stories, classify them by topic, and rank them by technical depth. The final query reports requests, tokens, cost, and cache hits from the database session. GitHub repo: https://github.com/realZachi/pg-jev (don't forget to star it ⭐) Postgres keeps the data and controls the query, while Jev handles the part SQL cannot express as a deterministic condition. If you want to understand what Jev is doing under the hood, I also wrote a hands-on guide to building a Jev-style model with open models, entirely locally. Read it below.
Oct 3, 2026 · 3.2K likesOpen on X
Avi Chawla shows Jev as a filter over a database. A traditional filter needs a precise, predefined condition, but many questions are semantic: is this article mainly about software engineering, which topic best describes it, how technically deep does it appear. Each one goes to Jev as a typed question, one per row.
Open the source