MYSQL function or PHP function, which one is better? [duplicate]
Possible Duplicate:
Performing simple arithmetic in MySQL statement or in PHP code
Im wondering what is the best to use, from point of view performance:
- PHP functions (to calculate a date in the future) and to input the date in the DB query
- MYSQL functi开发者_JAVA技巧on (to calculate a date in the future) e.g. TIMESTAMPADD(DAY,3,UTC_DATE()) directly inside the query
If you're manipulating dates in a table, it's definitely better to use MySql functions. This is particularly true if the mySql server might be accessed by different hosts (which might not have their clocks all synchronized with each other).
精彩评论