Improved MySql performance (one table or multiple tables) [closed]

0

What is the best performance (or how best to do) in a MySql database, multiple tables, for example 'customer_business_01, customer_business_02' or a 'customer_business' table with customer ID?

Example:

I have a system where I can register a customer, and register purchases made by that customer. There is no product registration, only customer (name, cpf, email ...), and purchases (product, quantity, value ...).

My question is whether I create a 'purchases' table for each sample customer 'purchases_01' for the client with ID 01, or if I create a 'purchases' table and place a 'CUSTOM_ID' column.

Normally I would do the second way by creating a 'purchases' table with the 'CLIENT_ID' column, but the question arose whether the queries will be faster if I use a table for all purchases or a table of purchases per customer .

Ps .: You will not have many customers, but many purchases.

    
asked by anonymous 27.12.2016 / 16:37

1 answer

3

TL; DR: A table.

If it had not been contextualized, the answer would be that there would be no difference , because forgetting the business rule to be applied, and understanding only the data storage, both cases would solve the problem, the performance would remain. Based on the first case, and disregarding the fact that there could be thousands of purchase tables, and suppose you would have a very ingenious way of scooping up the data, it would work. The problem is that it is not usual to do this Augusto. We have a few rules that help resolve this issue and ensure consistent storage. I suggest reading about Data Normalization:

  

Data normalization Database normalization is the process of transformation in the structure of a database that aims to   to eliminate redundancies and to eliminate insertion anomalies,   update and delete. Source: What is bank standardization   data?   

    
27.12.2016 / 18:16