Improve querying from DB using limit and offset to prevent loading all data from DB.