SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Database Design For Multiple Product Types


Database Design For Multiple Product Types

Author
Message
sahaamitabha123
sahaamitabha123
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
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.
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
SSCertifiable
SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)

Group: General Forum Members
Points: 5353 Visits: 4639
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search