Partial implementation of lazy SQL querying