Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AbdulBazith's avatar

Primary key and foreign key links from different Db in different hosting Laravel

Now what i planned is to use two hosting. the question bank will be in one hosting (hosting A) with its db the new school will be in one hosting(hosting B)with its db(this contains only assessment and reports of students)

why this plan is because if 'n' number of schools are added each school will be in separate hosting. but all of them will access the only one question bank db(hosting A).but all the school must be linked with the hosting A db.

is this right?? is this possible?? is the way is correct?

this is because, if many schools involved the the application will become slow, because in a school there will be more than 1000 students, so if they simultaneously write the exam then application will be slow.

in each hosting i will duplicate the application and each school will have separate db in their hosting. just the question bank will be in a single separate hosting and shared by other school in different hosting.

here primary key and foreign key will be linked from different hosting thats my biggest doubt??

0 likes
3 replies
hondnl's avatar

This can be a dangerous path you are following....

What if you want to change something in the student script or the DB architectuur .. Or there is a patch needed for a db. It means you have to go to each school and do an upgrade manually. I would rather expand my servers so you have one single place where your code and Database resides. And let's say 100 schools with 1000 students will give you a table of 100.000 , which is fine in databases. The only thing you should test on , is the amount of requests a minute you will receive. Will all those 100.000 students do the test at the same time ? Then an optimized code and a couple of server nodes should do the trick.... Especially if you host it for example in a cloud that automatically expand the server requirements.

But let's say you still want to continue with your plan. I would create an API on hosting A with the questions I would ask once all the questions and cache it. But there still will be 100.000 requests of each student for the questions...

AbdulBazith's avatar

@hondnl thank you for your response.

Ya i understood. but what my plan, is when each school registers it will became a separate db in separate hosting,. so that when when n number of school adds it takes n number of db and hosting.

why this because, when any server issue occurs or any school left i can easy remove that db. but when all school mixed in same db means remove a single school and separating a single school from the db is difficult i think so.

only the question bank resides in separate db hosting. that question is shared by different hosting and different schools

is this form ok

else suggest please

Please or to participate in this conversation.