开发者

MYSQL function or PHP function, which one is better? [duplicate]

开发者 https://www.devze.com 2023-03-29 21:59 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Performing simple arithmetic in MySQL statement or in PHP code
This question already has answers here: Closed 11 years ago.

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消