|
Posted by Ben Holness on 05/03/06 08:47
Hi all,
I am writing a php/mysql application in which I have to deal with around
500 product codes.
When a product code is referenced a table with the details of all product
codes is accessed.
I am not sure how best to optimize this code.
I am anticipating very high levels of activity for this particular part of
the application (it's a machine to machine interface).
Clearly the product id should be the primary key, but is it best to be
int, enum or varchar?
Here are the options:
1. Product code is represented by an int in the DB and is mapped to the
actual product code in a PHP array
2. Product code is an enum in the DB. The enum has all 500 odd product
codes in it
3. Product code is a varchar in the DB
Which would be best? Does php speed beat mysql speed in this scenario?
Ben
PS. Extrapolating further, is it best to use PHP or MySQL to, for example,
sort a dataset, format a date, make a calculation etc?
[Back to original message]
|