database - mysql table design, divide or all in one table? -


i have table house

create table `house`     `idhouse` int(11) not null auto_increment,    `type` mediumint(2) default null,    `address` varchar(5) default null,    `county` varchar(5) ... 

now, have ads functionality. want bring house ads

method 1 (directly add columns adds)

create table `house`     `idhouse` int(11) not null auto_increment,    `type` mediumint(2) default null,    `address` varchar(5) default null,    `county` varchar(5) ...    `ad_type` mediumint(2) default null,    `ad_urgency` int(11) default null,       `ad_status` int(11) default null,       

method 2 (normalization, split table ads)

create table `house`     `idhouse` int(11) not null auto_increment,    `type` mediumint(2) default null,    `address` varchar(5) default null,    `county` varchar(5) ...  create table `ads`     `idads` int(11) not null auto_increment,    `idhouse` int(11) not null auto_increment,       `ad_type` mediumint(2) default null,    `ad_urgency` int(11) default null,       `ad_status` int(11) default null,    
  • i'll more select (90%) operations instead of insert, update, delete (10%)
  • select operations all based on variables such ad_type, ad_urgency, , ad_status.
  • i'm taking consideration of performance lot.

which method should use ?
using method 1 (select without joining) faster method 2 (select joining) ?
if faster, how ? lot ?

normalization has alot of advantages.

  • it helps avoid redundancies.
  • it makes database structure flexible.
  • it helps avoid anomalies.
  • complex queries easier.
  • it minimizes data

...and few more.

the speed of queries cannot determined data structure alone, affected many different aspects database configuration, server hardware, indexing, data load , more.

but since less data means faster queries (with or without joins): go normalzied approach. database admin taking system on thank you.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -