The query is this:
$today = $date->getTimestamp();
SELECT t.*, u.screen_name, u.profile_image_url
FROM table AS t
LEFT JOIN users AS u
ON t.user_id=u.id_str
WHERE UNIX_TIMESTAMP(t.created_at) > {$today}
ORDER BY id DESC
LIMIT 12;
|
|
|
Even though you didn't post table definitions in your question so I can't tell for sure what is missed, the following indexes will be beneficial :
UPDATE Change |
|||||||||||
|