Thursday 15 August 2013

php - DECIMAL vs INT what is the best optimized choice? -


I'm sure the asking is incomplete without a precise reference, so I will try to explain it, and I will be clear Try
I need to store whole data with grams, mg, microgram and kelzol on the page.

All this data is 99999.99g (different to kelozole), so I can use Decimal (7,2) or Decimal (5,2) with older MySQL versions.

However, I have seen in my website, the DCIML datatype is heavier than a mediocre (I am wrong?) That can be enough to store the data.
Primarily, I will make the user operate digitally or float from the machine, and there is no need to restore it, so I doubt it about the best datatype in this case.

So what is the best datatype in this case?

A purpose of the database is to provide data integrity and ensure that data is which is close to the same natural nature, there is a need to store e-type data. Keeping this in mind, you should not attempt to optimize the data type for a database engine prematurely (unless you have a benchmark and you have a good reason). Instead, your efforts are better spent to properly design and index your table structures with the right relationships, where it is useful to help you deal with the amount of database engine and the type of data. is. You will be surprised how much data the DB engine can process if the data is corrected properly and indexes and relationships are made where appropriate.

So, as a best practice, decimals or partial numbers such as values, partial quantities etc.


1 comment: