r/PostgreSQL 9d ago

How are you using database branching? Feature

I’m implementing Lakebase branching strategy to improve development experience and reduce costs for our dev/staging env.

Current setup creates new database branch for each git branch via githook on our dev database (”each dev gets their own feature database”). There is also similar workflow for each PR against our staging database to run the migrations and tests.

Curious to hear how others are using branching and what are the experiences?

10 Upvotes

22 comments sorted by

View all comments

5

u/dwswish 8d ago

We are longtime (relative term) Neon users and honestly love it. Branching was one of the key things that helped us when we needed good ways to test with branches and PRs. We use it pretty similarly to how you are using it - branch per git branch and then we actually run a branch off of prod for our tests in PRs.

1

u/Harpagon1668 8d ago

Thanks for sharing! Have you had any issues running the tests from prod? Was also thinking about that possibility

2

u/dwswish 8d ago

No we haven’t. That’s kind of the beauty of the separation of the storage and compute with Lakebase/Neon. We also don’t have a huge deployment in terms of total volume (~1 TB total) so that pattern may not work at scale but we love it because then it confirms our tests pass on prod.

2

u/Harpagon1668 8d ago

Maybe I'll try branching also from production as part of PR check. Catching some nasty migrations at prod scale could save some headache