But most important thing, fetch results by batch instead of everything at one time.
This avoids huge memory consumption on big tables.