Don't overload processes with data. Wait for them to write it to stdin.
Let JDBC be smart about how many records to fetch at once.