@r_jain depending on your database you could try and read the data in chunks and append it to a CSV file