Skip to content

sqlite vs embedded postgres #7840

Closed
Closed

Description

@adsharma

Question

Have you considered using an embedded postgres server such as:

https://github.com/adsharma/pgserver/tree/pg18_2_39

over sqlite for sessions, messsages and file history?

This would give you access to pgvector and Tigerdata's pgvectorscale (DiskANN like indexing).

Activity

  1. github-actions commented on Jan 11, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Jan 11, 2026

    @rekram1-node
    Collaborator

    we will prolly start using sqlite instead soon

  3. adsharma commented on Jan 11, 2026

    @adsharma
    Author

    If opencode evolves into a general purpose platform beyond coding, people may have a lot of state sitting around.

    Scalability: pgvector > sqlite-vec

    The main reason people prefer sqlite is the embedded nature of the solution. That advantage goes away with pgserver and opens up the door to other postgres extensions like pgvectorscale and beyond.

    My motivation is to implement something like
    https://github.com/yichuan-w/LEANN like solution on top of general purpose session storage.

  4. pschiel commented on Jan 17, 2026

    @pschiel
    Contributor

    proposal to introduce storage interface, supporting json/sqlite: #9012

    postgres could be just another provider, selectable in your config

  5. adsharma commented on Jan 17, 2026

    @adsharma
    Author

    Excellent. I'm looking forward to pushing my work to pypi as a new package (didn't hear back from the maintainer of pgserver after a week, no activity on github).

    Will ping here once its on pypi and then we can look into writing an embedded postgres provider. Thank you for making the interface generic!

  6. pschiel commented on Jan 20, 2026

    @pschiel
    Contributor

    Excellent. I'm looking forward to pushing my work to pypi as a new package (didn't hear back from the maintainer of pgserver after a week, no activity on github).

    Will ping here once its on pypi and then we can look into writing an embedded postgres provider. Thank you for making the interface generic!

    unfortunately it wasn't received well, their own branch prefers hardcoding sqlite with no interfance and an unconfigurable schema.

  7. adsharma commented on Jan 21, 2026

    @adsharma
    Author

    https://github.com/Ladybug-Memory/pgembed - if you want to experiment with persisting session state with this backend.

  8. Rezrazi commented on Feb 11, 2026

    @Rezrazi

    @pschiel what was the reason your approach was dismissed? I do share the opinion of having a an interface for storage can benefit the project as it can allow for more distributed setups that can access and share the same history.

  9. adsharma commented on Feb 11, 2026

    @adsharma
    Author

    From an end user benefit point of view, the access to postgres extensions is a much bigger deal. But there is a perception that for embedded use sqlite works and postgres doesn't. Don't know where it comes from (other than familiarity with embedded sqlite).

  10. thdxr commented on Feb 14, 2026

    @thdxr
    Member

    sqlite is a better fit for the direction we're going, also maintaining agnostic storage backends is way too much overhead. you can replicate sqlite db into whatever you need

  11. adsharma commented on Feb 14, 2026

    @adsharma
    Author

    Similar discussion and decision here: kenn-io/roborev#213

    My guess is that over time opencode will support hosted postgres (shared coding agents). And similar to roborev-dev, will pursue a dual database strategy. This is likely based on the maintainer belief that:

    • SQLite is a good enough SQL implementation (which I agree)
    • SQLite has good enough vector search (I'm not sure if this is true)
    • SQLite has lower overhead in an embedded environment (resource usage, startup time)
    • SQLite provides a path to knowledge graphs and deterministic retrieval (As a maintainer of a graphdb, I'm biased)

    Pgembed is built around the belief that:

    • over time, the richer postgres extension ecosystem will provide customer benefit (pgvector, pgvectorscale)
    • the resource usage gap can be closed (added support for alpine containers recently)
    • gentler upgrade path when you outgrow local storage and want to explore hosted postgres for multi-agent state

    Please show up on our discord to discuss this topic further. Nanobot on pgembed is a proof of concept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions