I am trying to decide whether to create a global view table or 1 for each section. for example, let's say I have products, categories, and pages.
Do I have 3 tables, for example:
CREATE TABLE `tbl_products` (
`p_id` INT NOT NULL ,
`p_views` INT NOT NULL ,
INDEX ( `p_id` )
) ENGINE = MYISAM
CREATE TABLE `tbl_categories` (
`c_id` INT NOT NULL ,
`c_views` INT NOT NULL ,
INDEX ( `c_id` )
) ENGINE = MYISAM
CREATE TABLE `tbl_pages` (
`pg_id` INT NOT NULL ,
`pg_views` INT NOT NULL ,
INDEX ( `pg_id` )
) ENGINE = MYISAM
Or I have 1 table storing everything, for example.
CREATE TABLE `tbl_views` (
`view_id` INT NOT NULL ,
`view_type` VARCHAR( 10 ) NOT NULL ,
`view_views` INT NOT NULL ,
INDEX ( `view_id` )
) ENGINE = MYISAM
Where view_type is either products, categories or pages.
What will be the advantages / disadvantages of each solution?
Thanks in advance.
source
share