PHP MySQLi Query执行的时间比在phpMyAdmin中长得多

I'm running this in my PHP code:

$query = "select posts.content,posts.spotlights,timestampdiff(minute,posts.post_time,NOW()),users.name,users.username from posts,users where posts.post_id = $post_id and users.user_id = posts.user_id";
$result = $GLOBALS['db']->query($query);

And it takes 0.26 secs to execute in PHP. However, running the same query in phpMyAdmin with some random post_id assigned to $post_id takes around 0.001 secs to execute.

Why could this be and how can I fix this? Thank you!