Performance tunning for DB queries