HSBC interview question

fetching huge chunk of data in java from db approach