Prageeth Liyanage
Prageeth Liyanage

Reputation: 1772

All in one table or separate tables for each categories for a clasifieds website?

I am developing a classified website by using ASP.net and my DB is MYSQL. In there I am using a header table to store common records of an ad. like ad title, description, published date like wise. And I am using separate tables for store job category, real estate and vehicle categories etc.

Now I noticed that the column of many categories are identical. so now I have two approach

1) Follow the current approach ( 1 header table and separate tables for each categories )

2) Add extra columns to the header table and store all data in one table and maintain a column to identify the category of the ad.

So which is better by considering the performance when each category have millions of records.? If you have questions to clarify to give an answer please ask. Thank you very much

Upvotes: 1

Views: 399

Answers (1)

Scott Mackay
Scott Mackay

Reputation: 1214

It depends on how you will use the categories, if you have to search or aggregate across multiple categories then one table is probably better, if you have lots of categories, then again one table is better.

How much of a performance penalty will you really pay for having to select records based on the category if you have a suitable index set up?

Upvotes: 1

Related Questions