Adyen Interview Question

How to efficientize data retrieval from SQL tables.