« Haskell Activity | Main | On Not Designing XML languages »

Query optimization limitations: projection

Another problem for Links' current query optimization algorithm. It should be possible to create a proper query out of something like this (supposing y is a value that might or might not be in the table one or more times):

for x <- t in
where x == y

Yet currently the algorithm requires the loop variable to be used only through projections (e.g. x.age), giving up if it sees it used raw.

To compile this into SQL we'd probably need to expand it to a fieldwise comparison (x.a == y.a && x.b == y.b && ...) but that should be no sweat.

The slightly deeper problem is that the current algorithm works by tracking which variables correspond to which table fields, rather than a more general approach which would associate variables with table rows or fields. This might be a modest fix or it might require more digging.

Post a comment