4

Does anyone has the data of speed comparison between Eloquent ORM, Query Builder, and Raw SQL Queries? What is the better choose?

Gray
  • 115,027
  • 24
  • 293
  • 354
mrakodol
  • 1,143
  • 3
  • 12
  • 41
  • 1
    Speed comparisions? Are we talking of writing a query, or the time it takes to compile and then run? If it's the latter there will be such minimal differences it's not even worth doing a study. You should focus on caching complex query calculations. Worrying about milliseconds when you can save huge amounts in other areas is just pointless. – Cristian Feb 20 '13 at 14:02

1 Answers1

4

Raw SQL will always be the fastest because a human can always optimize the code and script to their liking. The query builder (aka Fluent) will be the next fastest, only slightly slower than Eloquent. That's because Eloquent uses Fluent within itself along with its own models and relationships.

If you're looking for pure processing speed, use raw SQL.

Otherwise use Eloquent for fastest development UNLESS you have no models and relationships, then use Fluent.

Lance Pioch
  • 1,147
  • 6
  • 18