Hi, i plan to use more than one databases in my app and colums will refrence each other.
What’s the best approach to reference foreign keys in other databases?
Hi, i plan to use more than one databases in my app and colums will refrence each other.
What’s the best approach to reference foreign keys in other databases?
What type of different databases you want to use? Are they all on the same database server?
Usually you want to keep all related data into a single database. What is the reason to use multiple databases?
They are same database server.
I want to have separate databases so i can scale them independently.
For example, a separate database for users and a separate database for chats.
If it’s possible ,what’s the best approach?
If it’s not a good idea, what can you suggest?
Having a cross database queries really can effect performance. Most database are well optimized to do fast joins between their own tables.
I would suggest using the same database - you can scale it just as easy.
Based on the example shared, consider using postgresql and store chats in json data type - postgresql has strong support for json and with right indexes your app can fly.
Keeping same db for a single app makes most sense. Fragmenting will be complex to maintain and scale.
For ref, India’s largest stock broker manages terabytes worth of sized postgresql databases. Read more here: https://zerodha.tech/blog/scaling-with-common-sense/
This is a GREAT Article!
Its topics are really relevant to Wappler developers as much as to any other group.
Every developer should read closely & consider the advice that standard CRUD functions with savvy SQL queries will streamline most apps to make the best use of their process stack without necessarily needing to SCALE up services, code & hardware resources to handle more users.
One Quote below from this article linked above:
RDBMS works, almost always.
97.42%* of all business problems can be reduced to CRUD, represented as relational data that need ACID guarantees and reporting that can be easily expressed as SQL. Very few problems need map-reduce or schemaless storage. This has more to do with the fundamental nature of businesses and business data than any technical underpinnings
This article basically assures us that Keeping-It-Simple will solve the vast majority of app read & store functions in combination with CACHE strategies & Redis queries.
Read this whole fascinating and valuable article!
There is a part two as well: https://zerodha.tech/blog/being-future-ready-with-common-sense/
2 Killer Articles in easy-to-understand language (English)
In fact, the entire range of articles at this website are hugely informative, as well as this one –
I"ve been tilting at windmills for a couple of years about relying on the big cloud tech companies for all your business services – increased dependency has already hamstrung large & small businesses.
SELF-HOSTING wherever possible to bring your most important client services IN HOUSE is a direction for Future Proofing, actually!
Here"s one of the key paragraphs from https://zerodha.tech/blog/being-future-ready-with-common-sense/