In an interview i was asked this question by an interviewer and i can't answer this question, plz reply me the answer.
The question is,
I had a table containg some rows and i divided it into 2 or more tables using normalization. Now which gives better performance a single table or a normalization tables. I said normalization tables give better performance. He asked me to give an example but i couldnt.
Plz give me an example with clear explanation.
Thanku.
Loading
Tuhin PaulPosted Mar 16, 2023, 2:41 PM
Let's say we have a database table called "Employees" with the following columns: EmployeeID, Name, Department, Address, City, State, and Zip. If we have thousands of employees, this table could quickly become large and unwieldy.
To normalize this table, we could split it into two smaller tables: "Employees" and "Departments". The "Employees" table would contain only the EmployeeID, Name, and DepartmentID columns. The "Departments" table would contain the DepartmentID, DepartmentName, Address, City, State, and Zip columns. By doing this, we reduce data redundancy since we no longer have to store the Department, Address, City, State, and Zip information for each employee. Instead, we can store this information in a separate table and reference it using the DepartmentID. In terms of performance, normalization tables can improve query performance since we can create indexes on the smaller tables to speed up searches. Since we're only storing information once, we can reduce the amount of disk space required to store the data.
Tuhin PaulPosted Mar 16, 2023, 2:39 PM
Normalization is a process of organizing data in a database to reduce data redundancy and improve data integrity. It involves dividing a large table into multiple smaller tables and establishing relationships between them. This approach is typically used in Relational Database Management Systems (RDBMS) like MySQL, SQL Server, and Oracle.
In terms of performance, normalization tables usually provide better performance compared to a single table.
Rajeev KumarPosted Mar 16, 2023, 10:08 AM
Normalization: Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table are easier."Database normalization is the process of organizing the attributes and tables of a relational database to minimize data redundancy."
Pradeep ShetPosted Mar 2, 2015, 4:55 AM
But this costs to it performance, so we need to denormalize it just if you want to fetch data.
For reference,
http://www.c-sharpcorner.com/UploadFile/cda5ba/understanding-normalization-in-database-design/
Jignesh TrivediPosted Feb 23, 2015, 11:06 PM
Hi,
Normalization: Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table are easier
Normalization may improve the query performance in some case.
As definition of normalization, more column table may split into multiple table (within logical grouping). when you want to fetch all the data you have required joins so it may degrade the performance of query.
hope this will help you.
SergePosted Feb 23, 2015, 10:24 AM
Pankaj Kumar ChoudharyPosted Feb 22, 2015, 8:41 AM
Michal HabalcikPosted Feb 22, 2015, 4:15 AM
"Database normalization is the process of organizing the attributes and tables of a relational database to minimize data redundancy."
More info: Wikipedia
Afzaal Ahmad ZeeshanPosted Feb 22, 2015, 3:49 AM
In the first, second and third stage you remove the grouping of data (redundancy), dependancies over non-key attributes or transitive dependancies. This way, the new tables (sub-tables) formed are free from these errors. Thus they're better in performance. They also don't have the anomalies for insertion, updation and/or deletion.