开发者

In MYSQL is it better to have one big table or many smaller tables

开发者 https://www.devze.com 2022-12-27 22:28 出处:网络
I am making a database of my client\'s customers to send email promotions to. The database will include all about 12 of my clients and 开发者_如何学运维each of them has an average of 2100 customers. I

I am making a database of my client's customers to send email promotions to. The database will include all about 12 of my clients and 开发者_如何学运维each of them has an average of 2100 customers. I was wondering if it would be better to have a table in the db for each one of my clients that contains a list of their customers or if I should just make one big table...

The customers will be queried daily.

I know it is a broad question but any advice would be appreciated.

Cheers,

Chuck


12 of my clients and each of them has an average of 2100 customers

This is an easy call: it's a one-to-many relationship between clients and customers, so why not have two tables with a foreign key relationship between them? The JOIN won't cost you much. I'd recommend normalizing it. The number of rows is trivial.

Make sure you add a UNIQUE constraint to the email address column in the customer table.


12 * 2100 = 25200 records which is peanuts for every modern database (if you provide appropriate indexes, that is).

So make it one big table (if this will ease the querying and it is a sort of ad hoc table).

EDIT: otherwise I'd take the normalize path as duffymo suggested.


You won't have to worry about database performance either way, but about the number of E-Mails you send out - 25,200 E-Mails is going to put a lot of strain on your mail server.

There may be another reason to keep separate tables, though: The E-Mail addresses you work with are confidential data from separate clients. It stands to reason that keeping separate tables is an additional layer helping to prevent mix-ups. Also, tables (=clients) can easily be dumped, dropped and/or added that way.


Or you can have one big table and several Views.
you will be able to do insert, update, delete directly from view.

0

精彩评论

暂无评论...
验证码 换一张
取 消