1

I tried implementing all of the three ways to fetch some data. I noticed that doctrine 2 ORM was faster than others. But when I searched about performance of the three on internet, I noted that SQL and DQL work more faster. If it is so, then what is the difference between the three ?

Which is more preferable to be used when fetching data

Deepanshu Goyal
  • 2,738
  • 3
  • 34
  • 61
Sunilspr7
  • 81
  • 1
  • 8

1 Answers1

1

You make a distinction between DQL, and ORM, but you don't specify what you mean by "ORM". If you are using DQL, you are using the ORM. It would be nice to see an example for each one of them, to clarify what you mean, and how you concluded that ORM was the fastest.

DQL is Doctrine's own language, and transforms to SQL. After the executing the SQL query, it will take the result set, and transform those into objects.

With that said, SQL performance is always going to be superior to DQL, because SQL does not do any transformations on the result.

K. Norbert
  • 10,494
  • 5
  • 49
  • 48