Skip to content

RAG & knowledge base · PostgreSQL and pgvector

A knowledge basethat backs its answers.

CoderConda builds a RAG knowledge base that makes your contracts, minutes and tickets searchable: every answer names its source, and where nothing is written, the system says so. A deadline from an old contract otherwise costs twenty minutes of searching.

An example with an invented corpus. This is what a sourced answer looks like.

Sample queryKnowledge base
Question

What notice period applies in the Meier framework contract?

Searched
12,400passages
Candidates
30
Left
3
  1. 0.91Meier framework contract 2024 · signedAnswers the question directly.kept
  2. 0.842025 addendum · signedA contradiction, and it goes into the answer.kept
  3. 0.62Minutes, 14 Mar 2025Context, not evidence.kept
  4. 0.58Meier framework contract · draft v3A draft loses against the signed version.dropped
  5. 0.41Template folder · no link to this contractWrong contract, dropped.dropped

Answer

Three months to the end of a quarter.

Source
Meier framework contract 2024, § 11 (2), page 7
Note
The 2025 addendum names six weeks for partial services. Both versions are signed.

01 — The evidence

Four questions.Four sources.

The corpus of an invented company: framework contracts, minutes, a quality manual, three years of tickets. For one question the sources contradict each other, for another the answer is nowhere. The system says both instead of smoothing them over.

01Answer with a contradiction

What notice period applies in the Meier framework contract?

Three months to the end of a quarter, under § 11 (2) of the 2024 framework contract. For partial services under annex 3, the 2025 addendum names six weeks. Both versions are signed, so the question needs settling before anyone serves notice.

Sources

  • Meier framework contract 2024, § 11 (2), page 7 · signed
  • Addendum 1, clause 4, page 2 · signed
02Unambiguous answer

How often must the lifting platforms be inspected?

Annually by a qualified person, plus an extended inspection every four years. That is what the quality manual says, chapter 6.2, as of March 2026. The platform in hall 2 was last inspected on 11 April 2026.

Sources

  • Quality manual, chapter 6.2, as of 03/2026
  • Maintenance log hall 2, entry 11 Apr 2026
03Not written anywhere

What payment terms apply to new customers in the first year?

There is no binding rule on this in the corpus. Three quotes from 2025 with 14 days and two with 30 days turned up, none referring to a policy. That is practice, not a rule. The question goes into the gap report.

Sources

  • No hit in policies, manual or contracts
  • Five quotes from 2025 as an indication, with no rule character
04Answer with a permissions note

Do colleagues have to take leave between Christmas and New Year?

Yes, three days must be held back for the company shutdown, set out in the 2023 works agreement, clause 5. A second source sits in a folder the person asking has no permission for. It was neither read nor quoted.

Sources

  • Works agreement on working time 2023, clause 5 · visible
  • One passage skipped · no access for this role

02 — The split

Badly split,plausibly wrong.

The same contract, split two ways. For answer quality this step decides more than the choice of model.

Meier framework contract 2024 · page 7

A · Split after 500 characters

Piece 1 · found…renews for twelve months at a time unless terminated with three months’ notice to the end of a quar

Piece 2 · not foundter. By way of exception, for partial services under annex 3…

Result

A period without its condition

The period sits in the first piece, what it refers to in the second. Anyone who finds only the first reads a period without its condition, and gets an answer that is accurate and still wrong.

B · Split along the structure

§ 11 (2) · Term and termination

The contract renews for twelve months at a time unless terminated with three months’ notice to the end of a quarter.

  • Meier framework contract 2024
  • § 11 (2)
  • signed
  • page 7
Result

A period with its condition and its source

A passage that stands on its own, with heading, source, version and date. It can be quoted without anyone having to put the original next to it.

03 — The build

Six parts.One database.

For vector search a second database often gets set up, with its own backup and its own permission model. At the volumes of a mid-sized company pgvector in PostgreSQL carries it, and your business data already sits there.

  1. 01

    Ingest

    PDF, Word, Confluence, tickets, mail archives, databases. Changed documents are read in again.

    PDF · wiki · tickets · SQL
  2. 02

    Split

    Passages with heading, source, date, version and owner. This is where answer quality is decided.

    Chunking with metadata
  3. 03

    Store

    PostgreSQL with pgvector. Vectors, full text and your business data in one database, with one backup and one permission model.

    PostgreSQL · pgvector
  4. 04

    Search

    Vector and full text combined, then reranked. Names and numbers do not get lost, and neither does meaning.

    Hybrid + reranking
  5. 05

    Permissions

    Every row carries its visibility. Anyone who may not open a document does not get it as a source either.

    Row level security
  6. 06

    Review

    Which questions come in, which stay open, where documents are missing. The report shows what nobody wrote.

    Gaps become visible

At very large corpora and very high load a specialised vector database is faster. Where that line falls for you, I calculate rather than assert.

04 — The offer

The survey first.Then the figure.

What the build costs depends on volume, format and the number of sources. That can only be said after a look at the corpus. A figure before that would be a guess, which is why there is none here.

  1. 01

    Survey

    1 week

    I read your corpus in, count what is there, and tell you what carries and what needs preparation.

  2. 02

    Build

    4 to 8 weeks

    Ingest, split, search and permissions. Quality is measured on fifty real questions, before the build and after every rebuild.

  3. 03

    Handover

    at the end

    Schema, ingest runs, permission model, test set and documentation. The corpus is yours, and the database is one any developer can read.

Figure

Before the build

I name the amount in writing after the first call, before anything is built.

Book the intro call
From you
Access to the file store and one person who can answer questions about its structure. Surveying, splitting and checking is my work.
Data
Operated in Germany, GDPR, a data processing agreement. On request entirely on your own infrastructure, with a model that never leaves the building.
Limit
Corpora made mostly of scans without a text layer, or of tables without structure, need preparation. I say so after the survey, not after the build.

05 — Objections

Six questions.Plain answers.

01Why PostgreSQL and pgvector instead of a vector database?

Because your business data already sits in a database, and a second system means backup, permissions and operations twice over. pgvector carries the data volumes that mid-sized companies deal with and allows vector search and full text in one query. For very large corpora a specialised database is the better choice. Then I say so and name the threshold in numbers.

02Is good full-text search not enough?

For names, numbers and clause references it is precise, which is why it stays part of the system. It fails where the question is worded differently than the document.

CriterionFull-text searchRAG system
QuestionKeywords.Full sentences.
ResultA list of documents.An answer with its sources.
SynonymsDoes not find them.Finds the meaning.
Names, numbersStrong.Equally, full text stays in the mix.
ContradictionNobody notices.Gets named.
GapZero results.“Not written anywhere”, plus a note.
03How do you prevent invented answers?

The model answers exclusively from the retrieved passages and names the source for every statement. If the search finds nothing suitable, the answer is that it is not written anywhere. That is measured against a fixed question set from your everyday work, not against how the demo felt.

04Who may see what?

Permissions hang on the data. Every passage carries its visibility, and the search runs in the context of the signed-in user. What somebody may not open in the file store appears in no answer either.

05What happens with changed documents?

Ingest is a repeatable run. Changed files are re-split and replaced, versions stay traceable. A new version replaces the old one, and where two signed versions contradict each other, the answer names both and flags the contradiction.

06How do I know whether it works?

By a measurement: fifty real questions, checked for whether the right source was among the first hits and whether the answer is correct. The number stands before the build and after every rebuild. Otherwise quality is an opinion.

One partner instead of five vendors0:31 · EN

Spoken in English · subtitles in German, English and Serbian

06 — Who builds it

One point of contact.The one who builds it, too.

I am Damjan Savić and built systems for large companies in the corporate world. Today I build the same technology for companies without an IT department of their own. I survey the corpus myself, I decide where it is split, and I check the fifty questions myself.

Damjan Savić
Senior full-stack developer · founder of CoderConda
Reachable
No call centre, no ticket system.
Location
Bergisch Gladbach, on site in the Rhineland, remote everywhere else.

07 — Appointment

Five questions are enough.The ones that keep coming up.

Name me five questions that keep coming up in your company. From those I can see whether your corpus carries and where documents are missing that nobody ever wrote. Pick a time straight from the calendar, no obligation and no sales pressure.

15 minutesno obligationwith the founder
Damjan SavićFirst call · 15 minutes · video
cal.com/coderconda

The calendar is hosted by cal.com.

Loading it opens a connection from your browser to cal.com (USA), which transmits your IP address; cal.com may set cookies when it loads. You can also go straight there instead.

Open at cal.com