Database Federation
Think of a school that opens a separate office for fees, one for exams, and one for the library. Each office is faster, but a question that needs two offices takes more work. Database federation does the same for data.
6 min read6 মিনিটে পড়া যায় · 8 sections8টি সেকশন · 1 source1টি সোর্স · updated Oct 2026আপডেট: Oct 2026
Split by function, joins get hardকাজ অনুযায়ী ভাগ, জয়েন কঠিন
Split one database into one for each area, then watch a join turn into two queries.একটি ডেটাবেসকে প্রতি এলাকায় একটি করে ভাগ করুন, তারপর দেখুন একটি জয়েন দুটি কুয়েরি হয়ে যায়।
You’ll learnআপনি শিখবেন
- A query can name one partitionকুয়েরি একটি পার্টিশনের নাম দিতে পারে
- Why a join becomes two queriesজয়েন কেন দুটি কুয়েরি হয়
- The app keeps the linksলিংক রাখে অ্যাপ
- Writes to two databases can splitদুই ডেটাবেসে লেখা আলাদা হতে পারে
- One failure hits only its areaএকটি ব্যর্থতা শুধু তার এলাকায়
In plain words
The term "database federation" has more than one meaning. Some people use it for a query over several data sources. This page uses a different meaning: one database for each area of the app. This choice of meaning is the tutorial's own.
The Azure page does not use the word "federation". The Azure Architecture Center calls this idea functional partitioning. The data is grouped by the way each bounded context of the system uses it Source 1সোর্স 1. A bounded context is a distinct business area with clear limits for its data and its functions Source 1সোর্স 1. For example, an online shop can keep its invoices in one partition and its stock levels in another Source 1সোর্স 1.
Before: [ one big database: customers + orders + inventory + invoices ]
After: [ customers DB ] [ orders DB ] [ inventory DB ] [ invoices DB ]This is not the same as sharding. In sharding, every partition has the same schema and holds a subset of the data Source 1সোর্স 1. In functional partitioning, each database holds a different kind of data.
সহজ English
The term "database federation" has more than one meaning. Some people use it for a query over several data sources. This page uses a different meaning: one database for each area of the app. This choice of meaning is the tutorial's own.
The Azure page does not use the word "federation". The Azure Architecture Center calls this idea functional partitioning. The data is grouped by the way each bounded context of the system uses it Source 1সোর্স 1. A bounded context is a distinct business area with clear limits for its data and its functions Source 1সোর্স 1. For example, an online shop can keep its invoices in one partition and its stock levels in another Source 1সোর্স 1.
This is not the same as sharding. In sharding, every partition has the same schema and holds a subset of the data Source 1সোর্স 1. In functional partitioning, each database holds a different kind of data.
বাংলা ব্যাখ্যা
"database federation" শব্দের একাধিক অর্থ আছে। কিছু মানুষ এটি ব্যবহার করে কয়েকটি ডেটা সোর্সের উপর একটি কুয়েরি বোঝাতে। এই পাতা অন্য অর্থ ব্যবহার করে: অ্যাপের প্রতিটি এলাকার জন্য একটি ডেটাবেস। এই অর্থ বেছে নেওয়া টিউটোরিয়ালের নিজের সিদ্ধান্ত।
Azure-এর পাতা "federation" শব্দ ব্যবহার করে না। Azure Architecture Center এই ধারণাকে বলে ফাংশনাল পার্টিশনিং (functional partitioning)। সিস্টেমের প্রতিটি বাউন্ডেড কনটেক্সট (bounded context) যেভাবে ডেটা ব্যবহার করে সেই অনুযায়ী ডেটা ভাগ করা হয় Source 1সোর্স 1। বাউন্ডেড কনটেক্সট হলো একটি আলাদা বিজনেস এলাকা, যার ডেটা আর ফাংশনের সীমা পরিষ্কার Source 1সোর্স 1। উদাহরণ: একটি অনলাইন শপ তার ইনভয়েস এক পার্টিশনে আর স্টকের পরিমাণ অন্য পার্টিশনে রাখতে পারে Source 1সোর্স 1।
এটি শার্ডিংয়ের মতো নয়। শার্ডিংয়ে প্রতিটি পার্টিশনের স্কিমা এক এবং তাতে ডেটার একটি অংশ থাকে Source 1সোর্স 1। ফাংশনাল পার্টিশনিংয়ে প্রতিটি ডেটাবেস আলাদা ধরনের ডেটা রাখে।
When you need it
The source names two gains of functional partitioning:
- If each business area has a clear bounded context, functional partitioning can give better isolation and faster data access Source 1সোর্স 1.
- It can keep data that changes apart from data that is only read Source 1সোর্স 1.
The source also names two gains of partitioning in general. They apply here too:
- Each partition can use a different type of data store. For example, large binary data can go in blob storage and structured data in a document database Source 1সোর্স 1.
- If one instance fails, only its partition is unavailable Source 1সোর্স 1. This matters less for managed platform-as-a-service stores, since the provider already builds in redundancy Source 1সোর্স 1.
Partitioning does not replace good database design. You still need the right indexes Source 1সোর্স 1. A single strategy is usually enough. If it is not, you can add horizontal partitioning, and sometimes a mix of both is more efficient Source 1সোর্স 1.
সহজ English
The source names two gains of functional partitioning:
- If each business area has a clear bounded context, functional partitioning can give better isolation and faster data access Source 1সোর্স 1.
- It can keep data that changes apart from data that is only read Source 1সোর্স 1.
The source also names two gains of partitioning in general. They apply here too:
- Each partition can use a different type of data store. For example, large binary data can go in blob storage and structured data in a document database Source 1সোর্স 1.
- If one instance fails, only its partition is unavailable Source 1সোর্স 1. This matters less for managed platform-as-a-service stores, because the provider already builds in redundancy Source 1সোর্স 1.
Partitioning does not replace good database design. You still need the right indexes Source 1সোর্স 1. A single strategy is usually enough. If it is not, you can add horizontal partitioning. Sometimes a mix of both is more efficient Source 1সোর্স 1.
বাংলা ব্যাখ্যা
সোর্স ফাংশনাল পার্টিশনিংয়ের দুটি সুবিধা বলে:
- প্রতিটি বিজনেস এলাকার বাউন্ডেড কনটেক্সট পরিষ্কার হলে ফাংশনাল পার্টিশনিং ভালো আইসোলেশন (isolation) এবং দ্রুত ডেটা অ্যাক্সেস দিতে পারে Source 1সোর্স 1।
- যে ডেটা বদলায় তাকে শুধু পড়ার ডেটা থেকে আলাদা রাখা যায় Source 1সোর্স 1।
সোর্স সাধারণভাবে পার্টিশনিংয়ের আরও দুটি সুবিধাও বলে। এগুলো এখানেও খাটে:
- প্রতিটি পার্টিশন আলাদা ধরনের ডেটা স্টোর ব্যবহার করতে পারে। উদাহরণ: বড় বাইনারি ডেটা ব্লব স্টোরেজে (blob storage) আর স্ট্রাকচার্ড ডেটা একটি ডকুমেন্ট ডেটাবেসে যেতে পারে Source 1সোর্স 1।
- একটি ইনস্ট্যান্স ফেইল করলে শুধু তার পার্টিশন পাওয়া যায় না Source 1সোর্স 1। ম্যানেজড platform-as-a-service স্টোরে এটি কম গুরুত্বপূর্ণ, কারণ প্রোভাইডার আগে থেকেই রিডান্ডেন্সি রাখে Source 1সোর্স 1।
পার্টিশনিং ভালো ডেটাবেস ডিজাইনের বদলে কাজ করে না। এখনো সঠিক ইনডেক্স লাগে Source 1সোর্স 1। সাধারণত একটি কৌশলই যথেষ্ট। যথেষ্ট না হলে হরাইজন্টাল পার্টিশনিং যোগ করা যায়। কখনো কখনো দুটির মিশ্রণ বেশি কার্যকর Source 1সোর্স 1।
Joins across databases
A query that crosses partitions is slower than a query in one partition Source 1সোর্স 1. Tuning the partitions for one set of queries can also hurt another set Source 1সোর্স 1.
With functional partitions, a query can name the partition it needs Source 1সোর্স 1. A join is harder. The application usually runs one query, takes a key, and then runs another query with a foreign key Source 1সোর্স 1. The source gives these options Source 1সোর্স 1:
- Keep the data for the most common operations together in one partition.
- Replicate or de-normalize the data that the join needs.
- If a join is needed, query the partitions in parallel and join the results inside the application. This does not work when the result of one query feeds the next query.
The database no longer protects the links between the parts. The application is responsible for referential integrity across partitions, so the source advises you to need it as little as possible Source 1সোর্স 1.
সহজ English
A query that crosses partitions is slower than a query in one partition Source 1সোর্স 1. Tuning the partitions for one set of queries can also hurt another set Source 1সোর্স 1.
With functional partitions, a query can name the partition it needs Source 1সোর্স 1. A join is harder. The application usually runs one query, takes a key, and then runs another query with a foreign key Source 1সোর্স 1. The source gives these options Source 1সোর্স 1:
- Keep the data for the most common operations together in one partition.
- Replicate or de-normalize the data that the join needs.
- If a join is needed, query the partitions in parallel and join the results inside the application. This does not work when the result of one query feeds the next query.
The database no longer protects the links between the parts. The application is responsible for referential integrity across partitions. So the source advises you to need it as little as possible Source 1সোর্স 1.
বাংলা ব্যাখ্যা
পার্টিশন পার করা কুয়েরি একটি পার্টিশনের ভিতরের কুয়েরি থেকে ধীর Source 1সোর্স 1। এক সেট কুয়েরির জন্য পার্টিশন টিউন করলে অন্য সেট কুয়েরির ক্ষতিও হতে পারে Source 1সোর্স 1।
ফাংশনাল পার্টিশনে একটি কুয়েরি যে পার্টিশন দরকার তার নাম দিতে পারে Source 1সোর্স 1। জয়েন (join) কঠিন। অ্যাপ্লিকেশন সাধারণত একটি কুয়েরি চালায়, একটি কী নেয়, তারপর ফরেন কী দিয়ে আরেকটি কুয়েরি চালায় Source 1সোর্স 1। সোর্স এই বিকল্পগুলো দেয় Source 1সোর্স 1:
- সবচেয়ে সাধারণ কাজের ডেটা একটি পার্টিশনে একসাথে রাখুন।
- জয়েনের জন্য যে ডেটা লাগে তা রিপ্লিকেট বা ডি-নরমালাইজ করুন।
- জয়েন দরকার হলে পার্টিশনগুলোতে একসাথে কুয়েরি চালান এবং অ্যাপ্লিকেশনের ভিতরে রেজাল্ট জয়েন করুন। একটি কুয়েরির রেজাল্ট যখন পরের কুয়েরিতে লাগে তখন এটি কাজ করে না।
ডেটাবেস এখন আর অংশগুলোর মাঝের লিংক রক্ষা করে না। পার্টিশন জুড়ে রেফারেনশিয়াল ইন্টেগ্রিটির (referential integrity) দায়িত্ব অ্যাপ্লিকেশনের। তাই সোর্স পরামর্শ দেয় যেন এর প্রয়োজন যতটা সম্ভব কম হয় Source 1সোর্স 1।
Transactions across databases
Some data stores give transaction guarantees only when the data is in one partition Source 1সোর্স 1. The source says to avoid transactions that touch more than one partition. If you need them, you build them in the application, because most partitioning systems do not support them natively Source 1সোর্স 1. The page Distributed Transactions explains the usual ways to do this.
Another route is eventual consistency. Each partition is updated on its own. The application makes sure that all the updates finish, and it handles what a reader can see while they run Source 1সোর্স 1. The source asks you to check first whether you really need strong consistency Source 1সোর্স 1.
Copies of data in several partitions bring the same problem: for a while, the partitions hold different values Source 1সোর্স 1.
সহজ English
Some data stores give transaction guarantees only when the data is in one partition Source 1সোর্স 1. The source says to avoid transactions that touch more than one partition. If you need them, you build them in the application, because most partitioning systems do not support them natively Source 1সোর্স 1. The page Distributed Transactions explains the usual ways to do this.
Another route is eventual consistency. Each partition is updated on its own. The application makes sure that all the updates finish. It also handles what a reader can see while they run Source 1সোর্স 1. The source asks you to check first whether you really need strong consistency Source 1সোর্স 1.
Copies of data in several partitions bring the same problem. For a while, the partitions hold different values Source 1সোর্স 1.
বাংলা ব্যাখ্যা
কিছু ডেটা স্টোর ট্রানজেকশনের গ্যারান্টি দেয় শুধু তখন, যখন ডেটা একটি পার্টিশনে থাকে Source 1সোর্স 1। সোর্স বলে, একাধিক পার্টিশন ছোঁয় এমন ট্রানজেকশন এড়িয়ে চলুন। দরকার হলে অ্যাপ্লিকেশনে সেগুলো বানাতে হয়, কারণ বেশিরভাগ পার্টিশনিং সিস্টেম এগুলো নিজে থেকে সমর্থন করে না Source 1সোর্স 1। Distributed Transactions পাতা এর সাধারণ উপায়গুলো ব্যাখ্যা করে।
আরেকটি পথ হলো ইভেন্চুয়াল কনসিসটেন্সি (eventual consistency)। প্রতিটি পার্টিশন আলাদাভাবে আপডেট হয়। অ্যাপ্লিকেশন নিশ্চিত করে যে সব আপডেট শেষ হয়। সেগুলো চলার সময় একজন রিডার কী দেখতে পারে তাও অ্যাপ্লিকেশন সামলায় Source 1সোর্স 1। সোর্স আগে যাচাই করতে বলে যে আপনার সত্যিই স্ট্রং কনসিসটেন্সি দরকার কি না Source 1সোর্স 1।
একাধিক পার্টিশনে ডেটার কপি রাখলে একই সমস্যা আসে। কিছু সময়ের জন্য পার্টিশনগুলোতে আলাদা মান থাকে Source 1সোর্স 1।
A real-life example
A learning platform has one database for students, courses, payments, and activity logs. The team splits it into a students database, a courses database, and a payments database. This example is the tutorial's own.
The course page needs data from courses only, so it is fast. The "my invoices" page needs the course title (in courses) and the amount (in payments). Before the split, one SQL join did this. Now the app asks payments for the invoices, and then asks courses for each title. The team can store the title with each payment to avoid the second query. That choice is a copy of data, so a renamed course may leave old titles in some payments.
সহজ English
A learning platform has one database for students, courses, payments, and activity logs. The team splits it into a students database, a courses database, and a payments database. This example is the tutorial's own.
The course page needs data from courses only, so it is fast. The "my invoices" page needs the course title (in courses) and the amount (in payments). Before the split, one SQL join did this. Now the app asks payments for the invoices, and then asks courses for each title. The team can store the title with each payment to avoid the second query. That choice is a copy of data. So a renamed course may leave old titles in some payments.
বাংলা ব্যাখ্যা
একটি লার্নিং প্ল্যাটফর্মে স্টুডেন্ট, কোর্স, পেমেন্ট আর অ্যাক্টিভিটি লগের জন্য একটি ডেটাবেস আছে। টিম এটিকে একটি students ডেটাবেস, একটি courses ডেটাবেস এবং একটি payments ডেটাবেসে ভাগ করে। এই উদাহরণ টিউটোরিয়ালের নিজের।
কোর্সের পাতায় শুধু courses থেকে ডেটা লাগে, তাই এটি দ্রুত। "my invoices" পাতায় কোর্সের টাইটেল (courses-এ) আর অ্যামাউন্ট (payments-এ) লাগে। ভাগ করার আগে একটি SQL জয়েন এটি করত। এখন অ্যাপ payments-কে ইনভয়েস জিজ্ঞাসা করে, তারপর প্রতিটি টাইটেলের জন্য courses-কে জিজ্ঞাসা করে। দ্বিতীয় কুয়েরি এড়াতে টিম প্রতিটি পেমেন্টের সাথে টাইটেল রাখতে পারে। এই সিদ্ধান্ত ডেটার একটি কপি। তাই একটি কোর্সের নাম বদলালে কিছু পেমেন্টে পুরোনো টাইটেল থেকে যেতে পারে।
Common mistakes
- Splitting without a clear business boundary. The source bases the split on a bounded context Source 1সোর্স 1. If the split is wrong, many common queries cross databases, and that is slower Source 1সোর্স 1.
- Expecting one transaction over two databases. Many data stores do not give it Source 1সোর্স 1.
- Forgetting the links between databases. Nothing in the database checks them for you, so the application must Source 1সোর্স 1.
- Forgetting backups. It can be hard to keep logical consistency when you back up and restore partitioned data Source 1সোর্স 1.
সহজ English
- Splitting without a clear business boundary. The source bases the split on a bounded context Source 1সোর্স 1. If the split is wrong, many common queries cross databases, and that is slower Source 1সোর্স 1.
- Expecting one transaction over two databases. Many data stores do not give it Source 1সোর্স 1.
- Forgetting the links between databases. Nothing in the database checks them for you, so the application must Source 1সোর্স 1.
- Forgetting backups. It can be hard to keep logical consistency when you back up and restore partitioned data Source 1সোর্স 1.
বাংলা ব্যাখ্যা
- পরিষ্কার বিজনেস সীমা ছাড়া ভাগ করা। সোর্স বাউন্ডেড কনটেক্সটের ভিত্তিতে ভাগ করে Source 1সোর্স 1। ভাগ ভুল হলে অনেক সাধারণ কুয়েরি ডেটাবেস পার করে, এবং সেটি ধীর Source 1সোর্স 1।
- দুটি ডেটাবেসের উপর একটি ট্রানজেকশন আশা করা। অনেক ডেটা স্টোর এটি দেয় না Source 1সোর্স 1।
- ডেটাবেসগুলোর মাঝের লিংক ভুলে যাওয়া। ডেটাবেসে কিছুই এগুলো আপনার জন্য পরীক্ষা করে না, তাই অ্যাপ্লিকেশনকে করতে হয় Source 1সোর্স 1।
- ব্যাকআপ ভুলে যাওয়া। পার্টিশন করা ডেটা ব্যাকআপ আর রিস্টোর করার সময় লজিক্যাল কনসিসটেন্সি রাখা কঠিন হতে পারে Source 1সোর্স 1।
What a tester can check
Tutorial advice
These test ideas are the tutorial's own advice.
- Find the boundaries. Ask which database holds each kind of data. List every feature that needs data from two or more databases.
- Test the joined pages. Check that a page built from two databases shows correct data when one value changes.
- Break the middle of an action. Stop one database during an action that writes to two. Check that the app does not leave half of the data.
- Orphan links. Delete a record in one database. Check what happens to the records in other databases that point to it.
- Stale copies. If data is copied, change the original and check how long the copy stays old.
- Backup and restore. Restore two databases from different times. Check whether the records still match.
সহজ English
These test ideas are the tutorial's own advice.
- Find the boundaries. Ask which database holds each kind of data. List every feature that needs data from two or more databases.
- Test the joined pages. Check that a page built from two databases shows correct data when one value changes.
- Break the middle of an action. Stop one database during an action that writes to two. Check that the app does not leave half of the data.
- Orphan links. Delete a record in one database. Check what happens to the records in other databases that point to it.
- Stale copies. If data is copied, change the original. Check how long the copy stays old.
- Backup and restore. Restore two databases from different times. Check whether the records still match.
বাংলা ব্যাখ্যা
এই টেস্টের ধারণাগুলো টিউটোরিয়ালের নিজের পরামর্শ।
- সীমানা খুঁজুন। জিজ্ঞাসা করুন কোন ডেটাবেস কোন ধরনের ডেটা রাখে। দুটি বা বেশি ডেটাবেস থেকে ডেটা লাগে এমন প্রতিটি ফিচারের তালিকা করুন।
- জয়েন করা পাতা টেস্ট করুন। দেখুন দুটি ডেটাবেস থেকে বানানো একটি পাতা একটি মান বদলালে সঠিক ডেটা দেখায় কি না।
- কাজের মাঝখানে ভাঙুন। দুটিতে লেখে এমন একটি কাজের সময় একটি ডেটাবেস বন্ধ করুন। দেখুন অ্যাপ ডেটার অর্ধেক রেখে যায় কি না।
- অরফান লিংক। একটি ডেটাবেসে একটি রেকর্ড মুছুন। দেখুন অন্য ডেটাবেসের যে রেকর্ডগুলো তার দিকে নির্দেশ করে তাদের কী হয়।
- পুরোনো কপি। ডেটা কপি করা থাকলে মূলটি বদলান। দেখুন কপি কতক্ষণ পুরোনো থাকে।
- ব্যাকআপ আর রিস্টোর। দুটি ডেটাবেস আলাদা সময় থেকে রিস্টোর করুন। দেখুন রেকর্ডগুলো এখনো মেলে কি না।
Key words
| Word | Meaning |
|---|---|
| Database federation | In this page: one database for each area of the app. This use of the term is the tutorial's own. |
| Functional partitioning | Data is grouped by the way each bounded context uses it Source 1সোর্স 1 |
| Bounded context | A distinct business area with clear limits for its data and functions Source 1সোর্স 1 |
| Cross-partition operation | A query or a transaction that touches more than one partition Source 1সোর্স 1 |
| Referential integrity | The rule that a link from one record to another points to a record that exists. In this setup the application keeps it Source 1সোর্স 1 |
| Eventual consistency | Each partition is updated on its own, and the application handles the data that is not yet equal Source 1সোর্স 1 |