{"slug": "show-hn-dbctx-compile-a-postgresql-database-into-compact-queryable-context", "title": "Show HN: Dbctx – Compile a PostgreSQL database into compact, queryable context", "summary": "Dbctx, a new open-source tool, compiles a PostgreSQL database into a compact, queryable context file (.dtx) that helps LLMs generate accurate SQL queries by including expected value sets and JSONB paths. The tool, available as a CLI, library, and UI in a single Go binary, filters schema to only relevant tables for a given natural language query, improving LLM response quality.", "body_md": "Hi HN, I've been finding increasing need for helping our users chat with the underlying application data in postgresql directly using LLMs, visualize results and so on.\n\nA major obstacle to this is -- traditional sql schema doesn't contain enough information for an LLM to easily query things in one shot.\n\nFor example, traditional schema doesn't say what is the expected/allowed value set in a state field, or what are the paths available embedded in a jsonb field.\n\nAlso -- given a user query -- only a small fraction of the whole schema is relevant for an LLM to construct SQL queries. So filtering parts of schema relevant to construct a prompt is important.\n\ndbctx solves all these by inspecting a postgresql database and turning the results into an sqlite backed \".dtx\" file. You can pass your natural language query to dtx, and get relevant tables in a compressed schema format along with field/json intelligence embedded in it. This leads to much better responses from the LLM from the getgo.\n\nI have a CLI, library and tiny UI embedded in a single go binary.\n\nDo give it a go, and any feedback welcome.\n\nComments URL: [https://news.ycombinator.com/item?id=49258397](https://news.ycombinator.com/item?id=49258397)\n\nPoints: 3\n\n# Comments: 0", "url": "https://wpnews.pro/news/show-hn-dbctx-compile-a-postgresql-database-into-compact-queryable-context", "canonical_source": "https://github.com/shrsv/dbctx", "published_at": "2026-08-11 13:53:36+00:00", "updated_at": "2026-08-11 14:13:24.395747+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence"], "entities": ["Dbctx", "PostgreSQL", "SQLite", "LLM"], "alternates": {"html": "https://wpnews.pro/news/show-hn-dbctx-compile-a-postgresql-database-into-compact-queryable-context", "markdown": "https://wpnews.pro/news/show-hn-dbctx-compile-a-postgresql-database-into-compact-queryable-context.md", "text": "https://wpnews.pro/news/show-hn-dbctx-compile-a-postgresql-database-into-compact-queryable-context.txt", "jsonld": "https://wpnews.pro/news/show-hn-dbctx-compile-a-postgresql-database-into-compact-queryable-context.jsonld"}}