执行以下查询时,我们遇到了非常高的 CPU 负载:
//find user
QueryBuilder<UserDTO, Long> userQb = userDao.queryBuilder();
userQb.where().idEq(userId);
UserDTO data = userQb.queryForFirst();
//find events
if (data != null) {
QueryBuilder<EventViewDTO, Long> eventQb = eventDao.queryBuilder();
data.eventViews = (ArrayList<EventViewDTO>) eventQb.join(userQb).query();
}
return data;
生成的数据总共约为 9kB。代码有什么问题吗?