Perform large queries lazily to reduce memory usage.