DEV Community

Discussion on: ORM vs Pure SQL: Which to Choose?

Collapse
 
gunabalans profile image
Gunabalan.S

ORM may initially provide a comfortable development experience, but its efficiency diminishes when dealing with a user base as small as 10,000. The slowdown becomes noticeable, especially with multiple joins or lengthy logic. In my personal experience with Laravel PHP projects, I opted to move away from ORM.

While direct SQL introduces challenges, such as data marshaling between JSON and objects or the serialization and de-serialization process, using query builders like Medoo PHP proved to be a wise choice. These tools are lightweight and alleviate some of the burdens, allowing for a smoother development process.

However, in situations where extensive processing is required, like generating invoices for over 10,000 users, employing stored procedures becomes a preferable solution.

Collapse
 
marmariadev profile image
Maria M.

Your experience highlights that there's no one-size-fits-all solution. Choosing between ORM and direct SQL depends on your project's specific needs and performance requirements. Query builders and stored procedures can be effective alternatives for certain situations.

Collapse
 
gunabalans profile image
Gunabalan.S

You are right.