I am trying to make a good decision about how to structure my MySQL database.
I can best explain this by example:
I have a table called customers
. A customer can control one or more sites
.
Sites
has his own table.
The tables customers
and sites
have a primary key id (AUTO-INCREMENT)
.
Most customers can modify multiple "sites" and we are growing towards 100.000 customers. All I need to do with this information is to check if a customer can edit a site.
The question is: how can I store my data best if I want to keep the queries to a minimum and the performance best?
1. I create a serialized array of all "sites" that a customer can edit and put it in a column in customers
table.
2. I create a child-table for customers
called customer-site
in which I write all site_id's that the customer has access to.
As you probably can read I don't have a lot of knowledge, so any information why is very appreciated!
Best regards, Abayob