Skip to content

Conversation

@leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Jan 7, 2026

What

Switch stellar-core's database from PostgreSQL to SQLite by default across all network configurations (local, testnet, pubnet, futurenet). PostgreSQL support is retained for backwards compatibility via the CORE_USE_POSTGRES=true environment variable.

Why

With RPC becoming more prevalent as the primary interface (vs Horizon), there may be scenarios where users run stellar-core and RPC instead of stellar-core, Horizon, and RPC - in which case PostgreSQL would be running solely for core's database.

Changes

  • SQLite is now the default database for stellar-core
  • PostgreSQL can still be used by setting CORE_USE_POSTGRES=true
  • PostgreSQL support for stellar-core in Quickstart is deprecated and may be removed in a future release
  • PostgreSQL is only started when Horizon is enabled OR when CORE_USE_POSTGRES=true

Close #875

Todo

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates stellar-core from using PostgreSQL to SQLite across all network configurations (testnet, pubnet, local, futurenet). The changes remove the core database creation from PostgreSQL initialization and ensure PostgreSQL only starts when Horizon is enabled. Documentation is updated to reflect that PostgreSQL is now exclusively for Horizon data.

Key Changes

  • Stellar-core configurations now use SQLite at /opt/stellar/core/stellar.db instead of PostgreSQL
  • PostgreSQL database initialization only runs when Horizon is enabled
  • Removed core database creation and related grants from PostgreSQL setup
  • Updated README to document that PostgreSQL is only for Horizon data

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
testnet/core/etc/stellar-core.cfg Changed DATABASE from PostgreSQL to SQLite
pubnet/core/etc/stellar-core.cfg Changed DATABASE from PostgreSQL to SQLite
local/core/etc/stellar-core.cfg Changed DATABASE from PostgreSQL to SQLite and removed commented alternatives
futurenet/core/etc/stellar-core.cfg Changed DATABASE from PostgreSQL to SQLite
start Updated init_db to only run for Horizon, removed core database creation, removed PostgreSQL dependencies from stellar-core initialization and startup
README.md Updated documentation to reflect PostgreSQL is only for Horizon; added note about historical PostgreSQL usage for stellar-core

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@leighmcculloch
Copy link
Member Author

Testing side-by-side with the latest stellar/quickstart image in --local mode, this change using sqlite reduces startup time by 4-5s, and memory usage by 40-50mb.

@leighmcculloch leighmcculloch marked this pull request as ready for review January 8, 2026 04:52
@leighmcculloch leighmcculloch requested review from a team January 8, 2026 23:20
@leighmcculloch
Copy link
Member Author

Updated the PR to retain PostgreSQL support for backwards compatibility. SQLite is now the default, but PostgreSQL can still be used by setting CORE_USE_POSTGRES=true.

PostgreSQL support for stellar-core in Quickstart is marked as deprecated and may be removed in a future release. If you're currently using PostgreSQL for stellar-core, please comment on #875 with information about your use case.

@leighmcculloch leighmcculloch enabled auto-merge (squash) January 8, 2026 23:54
@leighmcculloch leighmcculloch merged commit 92846f9 into main Jan 9, 2026
89 checks passed
@leighmcculloch leighmcculloch deleted the stellar-core-sqlite branch January 9, 2026 00:07
@github-project-automation github-project-automation bot moved this from Backlog (Not Ready) to Done in DevX Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Configuring stellar-core to use SQLite instead of PostgreSQL

3 participants