LISPOS: My manifesto
Wed, 01 Apr 1998 04:32:40 +0000
> (select '(name) :from users :where (lambda (x) (= (acctnum x) 44833)))
> can't use the primary-key index on users by acctnum, it has to look at
> every record and call the lambda function on it.
> This means that what was originally a simple hash-table lookup and
> fetch, or possibly a b-tree lookup and fetch, becomes a process that
> requires fetching something like 50,000 records from disk and calling a
> couple of Scheme functions for each one of them.
> This does not meet my definition of `essentially for free'.
That's true, but it would be possible to analyse the lambda
expression and do optimisations on it. Pass everything possible
off to the database engine and perform the rest yourself. This
would not be a trivial excercise to implement, but would be well
worth it if you planned to do a lot of random queries.