3 ms·
An ORM (object-oriented mapping) is, by its nature, a wrapper on top of a language designed to work with relational data in third normal form (think of this for
by davidhyde 5y ago
An ORM (object-oriented mapping) is, by its nature, a wrapper on top of a language designed to work with relational data in third normal form (think of this format as reducing data duplication). Objects are more like graphs. Developers like to abstract above complexity and are often tempted to skip learning SQL altogether when using ORMs. You can get away with this when there are low volumes of data or database operations map cleanly with basic CRUD program operations.
To answer you question though, using SQL is not just about raw performance, it is also about not having to copy large volumes of data from the database to the application server for processing. So in that regard it saves memory. The reason for this is that not all ORM operations can be cleanly mapped to SQL.
SQL is a simple language and it is sometimes easier to reason about what the developer is trying to do rather than reading application code. It is also sometimes easier to run stand-alone sql against the database so it's useful for troubleshooting. Of course there are many downsides but you asked for some good reasons to use it :)