Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to split a Large Database Table?

I'm working on an 'Employee' database and the fields are beginning to add up (20 say). The database would be populated from different UI say:

Personal Information UI: populates fields of the 'Employee' table such as birthday, surname, gender etc

Employment Details UI: populates fields of the 'Employee' table such as employee number, date employed, grade level etc

Having all the fields populated from a single UI (as you would imagine) is messy and results in one very long form that you'd need to scroll.

I'm thinking of splitting this table into several smaller tables, such that each smaller table captures a related information of an employee (i.e. splitting the table logically according to the UI).

The tables will then be joined by the employee id. I understand that splitting tables with one-to-one relationship is generally not a good idea (multiple-database-tables), but could splitting the table logically help, such that the employee information is captured in several INSERT statements?

Thanks.

like image 928
SleepingSpider Avatar asked Jan 06 '12 12:01

SleepingSpider


People also ask

When should you split a database?

Consider splitting any database that several people share over a network. Splitting a shared database can help improve its performance and reduce the chance of database file corruption. After you split database, you may decide to move the back-end database, or to use a different back-end database.

Why would we want to split data into separate tables?

In many cases, it may be best to split information into multiple related tables, so that there is less redundant data and fewer places to update.

How many columns is too much in a database table?

The number of tables in a database is limited only by the number of objects allowed in a database (2,147,483,647). A standard user-defined table can have up to 1,024 columns.


1 Answers

Your data model should not abide to any rules imposed by the UI, just for convenience. One way to reduce the column-set for a given UI component is to use views (in most databases, you can also INSERT / UPDATE / DELETE using simple views). Another is to avoid SELECT *. You can always select subsets of your table's columns

like image 174
Lukas Eder Avatar answered Sep 26 '22 18:09

Lukas Eder