Re: Object-relational impedence

From: Tegiri Nenashi <>
Date: Wed, 5 Mar 2008 09:26:39 -0800 (PST)
Message-ID: <>

On Mar 5, 7:48 am, Marshall <> wrote:
> The most gratuitous example I can think of was some early
> EJB containers I played with, back when I was still thinking
> that ORM was something that could possibly be done well.
> Against a table of a few hundred rows, one could execute
> "delete from table". The comparable command through the
> ORM issued SQL to load every row as an object, then
> in a loop called obj.delete() which issued a single DELETE
> statement for that row. It was ten thousand times slower,
> and that's for only a couple hundred rows. Of course this
> example is extreme, but it's still illustrative of a general
> principle.
> I have *often* seen four and five order of magnitude
> performance difference between straight SQL and
> ORM SQL, across a wide variety of ORMs. The
> very idea of ORM demands it: you have to try to
> push a whole set-oriented language through a functional
> interface.

Yep, this is "drive car to supermarket" analogy in Stephane Faroult video
Part 2: It is a recurrent theme of application database performance meetings.

Why set oriented processing is more friendly to optimisation? (Contrary to a moronic blanket statement that joins are bad). Because there is a little nice algebra behind it, so that optimization is essentially algebraic manipulation with query expressions. This is not an easy subject to master of course, so why some people have chosen to hide their head in the sand of imaginary code reorganisation problems is perfectly understandable. Received on Wed Mar 05 2008 - 18:26:39 CET

Original text of this message