I am creating a MySQL database that will have a lot of entries with timestamps. The entries will be attached to a specific user and another index (for example a blogger and his few sites). What is the best way to calculate a graph of entries per day for user/globally.
My two approaches would be to make the calculations on my server with PHP, or send an array with timestamps back to the user, and he would then calculate any graphs with javascript or mobile device app. The second option would have a bigger impact on bandwidth, but may save server processing time.
Unless you need the additional timestamps for something else, I would only send back the records that need to be displayed.
Without knowing the specific schema of your database, the query would be something like this:
SELECT stamp
FROM entries
JOIN users ON entries WHERE users.id = entries.user_id
AND users.id = 1234;
This would give you a result set that contain timestamps only for the selected user ID (1234, in this case).