I'm on a bus on the way to work, time to make one of my long and meandering posts. In a recent blog post, Andrew Coates pulled me up on a throw-away comment I made during a class that I was teaching, I responded saying that I would post up on the subject at a later date, that later date is today.

The 50,000ft overview of the comment was that I don't like SQL and that I think that there has to be a better way. I offered up some code like the following as how one might achieve a set based programming model in C#:

Table t = Table.FromName("Products");

Query q = new Query();

q.Source = t;

q.Filter.Add("Price", QueryOperators.GreaterThan, 50);

Set s = q.Execute();

I realise now that my thinking was fundamentally flawed but about replacing SQL (a set based language) with C# (a procedural language), especially when the object model looks suspiciously like SQL. I like the idea of visual query tools like the QBE grid, and find myself using it more and more.

What could be done to innovate on that design surface to make it easier to DESIGN increasingly more complex queries whilst maintaining simplicity, but also performance? If we look at the tools in VS2005, they still seem pretty much concerned with the mapping into a in memory database (DataSet), but the way the data gets there and back is still Transact-SQL (sub in your query language of choice here).

Personally, I think if I knew the answer to that question every RDBMS vendor in the world would be offering me a job, either that or the high priests of the SQL Cult would put a contract out on me.

All this speculation about building a better query language has gotten me thinking about database implementation and the complexities involved including IO performance, transaction and lock management, indexing and query analysis. Naturally these sorts of thoughts lead to "How would I do it?", or more specially "How would I do it in .NET?".

It might just be the exhaust fumes talking, but I am tempted to give it a shot, or at least think about giving it a shot enough that I get scared and go running home like a little girl (no offence to little girls intended).