Some of these might make little sense, but:
- Sql code interpreted or compiled (and to what)?
- What are joins translated into – I mean into some loops or what?
- Is algorithm complexity analysis applicable to a query, for example is it possible to write really bad select – exponential in time by number of rows selected? And if so how to analyze queries?
Well … quite general questions, so some very general answers
1) Sql code interpreted or compiled (and to what)?
SQL code is compiled in to execution plans.
2) What are joins translated into – I mean into some loops or what?
Depends on the join and the tables you’re joining (as far as i know). SQL Server has some join primitives (hash join, nested loop join), depending on the objects involved in your sql code the query optimizer tries to choose the best option.
3) Not reallyIs algorithm complexity analysis applicable to a query, for example is it possible to write really bad select – exponential in time by number of rows selected? And if so how to analyze queries?
Not really sure, what you mean by that. But there are cases where you can do really bad things, for example using
on a table without an index on col to find the lagest value for col instead of
You should get your hands on some/all of the books from the SQL Server internals series. They are really excellent an cover many things in great detail.