I am currently working on a project that will have a heavy load of date/time calculations in it. PHP and MySQL have a few similar functions, but MySQL seems to have even more functions overall.
In terms of speed, is it better to perform your data calculations with your SQL commands or do you feel it is better to use your script to perform your calculations?
Date/Time Calculations: Inline Script or Database?
Moderator: General Moderators
- voodoo9055
- Forum Commoner
- Posts: 51
- Joined: Sat Apr 26, 2003 3:27 pm
- Location: Montgomery, AL
Really, really depends...
I'd guess MySql directly. Have in mind that if you can do everything on the database without using PHP, you do not need to query it, hence you dont need to use resources on the actual data-transport between db-php-db.
Make two scripts. Both producing a similiar result as in the final script. One in PHP and the other in the db. Loop it and take the time using microtime() or similiar.
I'd guess MySql directly. Have in mind that if you can do everything on the database without using PHP, you do not need to query it, hence you dont need to use resources on the actual data-transport between db-php-db.
Make two scripts. Both producing a similiar result as in the final script. One in PHP and the other in the db. Loop it and take the time using microtime() or similiar.
- voodoo9055
- Forum Commoner
- Posts: 51
- Joined: Sat Apr 26, 2003 3:27 pm
- Location: Montgomery, AL
- voodoo9055
- Forum Commoner
- Posts: 51
- Joined: Sat Apr 26, 2003 3:27 pm
- Location: Montgomery, AL