@@ -3337,7 +3337,6 @@ <h2>What are the downsides of using an ORM?</h2>
33373337< p > There are numerous downsides of ORMs, including</ p >
33383338< ol >
33393339< li > impedance mismatch</ li >
3340- < li > difficulty expressing complex queries</ li >
33413340< li > potential for reduced performance</ li >
33423341< li > shifting complexity into the application from the database layer</ li >
33433342</ ol >
@@ -3347,6 +3346,24 @@ <h3>Impedance mismatch</h3>
33473346moving data between relational tables and application objects. The gist
33483347is that the way a developer uses objects is different from how data is
33493348stored and joined in relational tables.</ p >
3349+ < h3 > Potential for reduced performance</ h3 >
3350+ < p > One of the concerns that's associated with any higher-level abstraction or
3351+ framework is potential for reduced performance. With ORMs, the performance
3352+ hit comes from the translation of application code into a corresponding SQL
3353+ statement which may not be tuned properly. </ p >
3354+ < p > ORMs are also often easy to try but difficult to master. For example, a
3355+ beginner using Django might not know about the
3356+ < a href ="https://docs.djangoproject.com/en/1.8/ref/models/querysets/#select-related "> < code > select_related()</ code > function</ a >
3357+ or how that can dramatically improve some queries' performance with
3358+ foreign key relationships. There are dozens of performance tips and tricks
3359+ for every ORM and it's possible that investing time in learning those
3360+ quirks may be better spent just learning SQL and how to write stored
3361+ procedures.</ p >
3362+ < p > There's a lot of hand-waving "may or may not" and "potential for" in this
3363+ section. In most cases ORMs are good enough for roughly 80-90% of use cases
3364+ and in 10-20% of database interactions there can be major performance
3365+ improvements by having a knowledgeable database adminstrator write tuned
3366+ SQL statements to replace the ORM's generated SQL code.</ p >
33503367< h2 > Django's ORM</ h2 >
33513368< p > The < a href ="/django.html "> Django</ a > web framework comes with
33523369its own built-in object-relational mapping module, generally referred to
0 commit comments