Jump to content

Need advice in making databases


subhomoy
Go to solution Solved by Jacques1,

Recommended Posts

Hello everyone,

 

I'm going to create my school project and I really need your advice.

 

My Project Summary 

 

I need to create a new website where the user can add new schools in my site. After creating, they can add students, add teachers, add principal and hell lot of things from their admin panel. And in the frontend they will get their own urls and can display their schools.

 

Ex1: example.com/st_sebastians/  <------- School name.

Ex2: example.com/st_augustin/  <------- School name.

 

When the user will visit those url they will see all the contents of their respective schools.

 

My Questions

 

How can I create those database. For that I've thought of two methods.

 

1) I will create multiple database for every user/school dynamically using php and saves the record in it.

(I searched on google that it is very prone to mysql injection.)

 

2) I will create a single database with everything related to their (school id) and stores in the single database.

 

Example Student table

 

id | school_id | name | roll |

----------------------------------------------

1  |    1             | Subho | 123456

----------------------------------------------

2  |    5             | xyz      |  236566

----------------------------------------------

3  |   45            | asfgf    | 778219

 

.

.

.

.

.

.

.

.

 

Please note that the database are going to store whole lot of records and I don't want to it slow down.

 

Any Help will be highly appreciated.

Thank You In advance...

Link to comment
Share on other sites

  • Solution

You should definitely have a single database for the entire application. Creating a new database for every school is a bad idea. Not only is it insecure, it's also a huge problem for backups and updates, because you'd have to repeat everything for each database.

 

 

 

Please note that the database are going to store whole lot of records and I don't want to it slow down.

 

MySQL was designed to handle hundreds of millions of rows. I'm fairly sure your school project needs a lot less than that.

Link to comment
Share on other sites

[Moving to MySQL Forum]

 

There is no indexing 'method', but there are best practices. There are many different considerations when determining what to index and I am by no means a DBA. I would suggest reading up on the subject. There are also ways to analyze queries to determine where indexes may be needed. Here are a few resources that may be of help.

 

http://dev.mysql.com/doc/refman/5.7/en/mysql-indexes.html

https://dev.mysql.com/doc/refman/5.7/en/using-explain.html

http://www.databasejournal.com/features/mysql/article.php/3840606/Maximizing-Query-Performance-through-Column-Indexing-in-MySQL.htm

http://www.slideshare.net/matsunobu/more-mastering-the-art-of-indexing

Edited by Psycho
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.