Menu

1 / 2

Full-Text Search on a 2 GB PostgreSQL Instance

DEV Community·Sylvain Artois·6 months ago
#6MTain5t
#bug#postgres#database#query#search
Reading 0:00
15s threshold

AFK.live aggregates headlines from 250+ news sources. I needed search. I had a 2 GB database and no budget for Elasticsearch.

Fair warning : this article goes deep into PostgreSQL internals — query plans, GIN indexes, trigram scoring. I've added links throughout for context. If you're not familiar with these concepts, the links are there for you. If you are, skip them and enjoy the war stories.

The Constraint

AFK runs on a Scaleway managed PostgreSQL instance — the smallest tier they offer:

DB-PLAY2-PICO : 1 vCPU, 2 GB RAM

Cost: roughly 70% of the entire AFK hosting budget (50€)

No PGVector. No Elasticsearch. No Typesense. Just PostgreSQL 16 with the pg_trgm and unaccen extensions, which Scaleway includes by default on managed instances.

The headlines table has grown past 1 million rows.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.