Help us understand the problem. What is going on with this article?

【 Laravel 】LaravelのEloquentとPDOの実行時間を比較する

More than 1 year has passed since last update.

結論

PDOの方がEloquentよりも5.7倍速い。

# 実行時間
Eloquent 0.01072883605957秒
PDO 0.0018770694732666秒
// Eloquent
$test = Test::whereBetween('id', [$start_id, $end_id])->get();

// PDO
$base = DB::connection()->getPdo()->prepare('SELECT * FROM test WHERE id BETWEEN :start_id AND :end_id');
$base->bindValue(':start_id', $start_id, PDO::PARAM_INT);
$base->bindValue(':end_id', $end_id, PDO::PARAM_INT);
$base->execute();
creema
全国のつくり手とつかい手が Web 上で直接作品を売買できる、日本最大級のハンドメイドマーケットプレイス「Creema」の企画、開発、運営するスタートアップです。「本当にいいものが埋もれてしまうことのない、フェアで大規模な新しい経済圏をつくろう」を合言葉に、メンバー一丸となって、たのしくストイックに活動を行っています。
https://www.creema.co.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした