Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Database Design For Multiple Product Types Expand / Collapse
Author
Message
Posted Saturday, June 15, 2013 7:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, April 09, 2014 4:16 AM
Points: 7, Visits: 16
I have a database containing different product types. Each type contains field that differs greatly with each other. The first type of product, is classified in three categories. The second type of product, is classified in three categories. But the third and the fourth one, is not classified in anything.

Each product can have any number of different properties.

I have a huge database,which containing about 500000 product in product table.

So when I am going to fetch a product from database with all its attributes, or going to search product filtering by attributes, it makes effect on performance badly.

Could any one can help me what will be the tables structure in sql . Because different ecommerce sites are using this kind of database and working fine with huge different types of products.

Post #1463847
Posted Wednesday, July 31, 2013 8:58 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, January 28, 2014 8:15 AM
Points: 3,068, Visits: 4,639
sahaamitabha123 (6/15/2013)
I have a database containing different product types. Each type contains field that differs greatly with each other. The first type of product, is classified in three categories. The second type of product, is classified in three categories. But the third and the fourth one, is not classified in anything.

Each product can have any number of different properties.

I have a huge database,which containing about 500000 product in product table.

So when I am going to fetch a product from database with all its attributes, or going to search product filtering by attributes, it makes effect on performance badly.

Could any one can help me what will be the tables structure in sql . Because different ecommerce sites are using this kind of database and working fine with huge different types of products.



Two basic tables, tbl-products and tbl-products-attributes

>> basic columns for tbl-products
product_code PK,
category,
blah... blah... blah...

>> basic columns for tbl-products-attributes
product_code FK pointing to tbl-products(product_code)
product_attribute_code
blah... blah... blah...
Please make sure of making tbl-products-attributes PK as (product_code,product-attribute_code)

In regards to the 'category' issue, fake it! for third and fourth types of products make all of them belong to category = "ALL"

By the way, when asked about the reasons why you choose to define the "ALL" category, do not say "I faked the category", you can phrase it like: "products types 3 and 4 can be considered as having an implicit category to which all belong - this choice allows to model all products the same way bringing more flexibility to the overall design"

Hope this helps.


_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Post #1479524
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse