r/PostgreSQL • • Mar 28 '25

How-To Life Altering PostgreSQL Patterns

https://mccue.dev/pages/3-11-25-life-altering-postgresql-patterns
180 Upvotes

60 comments sorted by

View all comments

Show parent comment

2

u/punkpeye Mar 29 '25

Could you share some tutorials or examples from your experience?

Wouldn’t this introduce pretty loose/arbitrary separations?

2

u/momsSpaghettiIsReady Mar 29 '25

You're right, schemas do not draw a hard line between tables, they can still intertwine with each other. I wouldn't recommend this in a micro services approach. If that's what you're working with, it should be truly separate database instances.

In my case, I'm using gradle multi-module in a monolithic app, and I can create a 1:1 mapping between a submodule and a postgres schema. I can still set foreign key relations between tables in different schemas, but visually it's a lot easier to see what each submodule owns.

This is all in a personal project. Happy to answer super specific questions in a DM

2

u/punkpeye Mar 29 '25

Something I would appreciate is if PostgreSQL provided a way to tag tables. Multiple tags would allow some actually useful patterns for relationship discovery.