2010/6/21 Ricardo Aráoz <ricar...@gmail.com>: > On 19/06/10 18:51, Publius Maximus wrote: >> This is the magic behind sending a LINQ expression from a client to a >> SQL server, and the code actually being executed on the server side. I >> don't mean like a typical SQL query, where it sends text that needs to >> be parsed, in this case, it's the fully "ready to execute" >> representation that gets immediately executed. >> >> > > You mean the difference is the sql query gets parsed in the client? Or > the coder has to parse it? What's the big advantage of that? Never had > problems with an sql query being parsed in the server. > And what is a "ready to execute representation"? Do you mean the server > does not get to decide the strategy of the query based on resources and > such?
Because SQL server since 2005 is built on the CLR, it can take the expression tree created by the LINQ query -- already pre-compiled on the client -- and execute it more or less as-is on the server. This isn't to suggest there was a problem with parsing SQL on the server side, though precompiled queries defined on the server side are known to execute better than their text-based equivalents coming dynamically from the client side. The idea is that LINQ queries take advantage of that approach but does not limit the precompilation to the server side. It's just a nifty aspect of the LINQ implementation, the concepts for which were invented by the folks who invented Haskell's Monad and related abstractions (of whom Erik Meijer, now at MS, was a key player). The idea of passing code around as data is the main innovation, and it is already proving important for multicore and distributed computing in practice. - Publius > > [excessive quoting removed by server] _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/aanlktilvnoudedvostl6rod81dvnu_dgelvu8wvm8...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.