Probleme de temps de requete sur pollen 1
Salut, Il y pas mal de requete pollen qui prennent enormement de temps :(. Je pense qu'il manque un index ou un truc dans le genre. par exemple ici la requete prend 1m30 :( ça fait trop long 2014-09-29 12:36:28 CEST LOG: duration: 92288.073 ms execute <unnamed>: select commentimp0_.topiaId as topiaId1_1_, commentimp0_.topiaVersion as topiaVer2_1_, commentimp0_.topiaCreateDate as topiaCre3_1_, commentimp0_.text as text4_1_, commentimp0_.postDate as postDate5_1_, commentimp0_.author as author6_1_, commentimp0_.pollAccount as pollAcco7_1_ from public.comment commentimp0_ cross join public.poll pollimpl1_ where pollimpl1_.pollId=$1 and (commentimp0_.topiaId in (select comment2_.topiaId from public.comment comment2_ where pollimpl1_.topiaId=comment2_.poll)) C'est toujours cette requete qui prend du temps, la moyenne doit etre dans les 20s :( Je suis en train de regarder mais si quelqu'un a une idée rapidement, je prend :D -- Benjamin POUSSIN -------------------- tél: +33 (0) 2 40 50 29 28 email: poussin@codelutin.com http://www.codelutin.com
On Mon, 29 Sep 2014 12:43:54 +0200 Benjamin POUSSIN <poussin@codelutin.com> wrote:
Salut,
Il y pas mal de requete pollen qui prennent enormement de temps :(. Je pense qu'il manque un index ou un truc dans le genre.
par exemple ici la requete prend 1m30 :( ça fait trop long
2014-09-29 12:36:28 CEST LOG: duration: 92288.073 ms execute <unnamed>: select commentimp0_.topiaId as topiaId1_1_, commentimp0_.topiaVersion as topiaVer2_1_, commentimp0_.topiaCreateDate as topiaCre3_1_, commentimp0_.text as text4_1_, commentimp0_.postDate as postDate5_1_, commentimp0_.author as author6_1_, commentimp0_.pollAccount as pollAcco7_1_ from public.comment commentimp0_ cross join public.poll pollimpl1_ where pollimpl1_.pollId=$1 and (commentimp0_.topiaId in (select comment2_.topiaId from public.comment comment2_ where pollimpl1_.topiaId=comment2_.poll))
C'est toujours cette requete qui prend du temps, la moyenne doit etre dans les 20s :(
Je suis en train de regarder mais si quelqu'un a une idée rapidement, je prend :D
J'ai l'impression que les index sont bons :( on peut utiliser $1='5edfa94c043540acbb47f880cc8527bf' pour des tests. Donc voici le code qui fait cette requete public List<Comment> getAllComments(String pollId) { Preconditions.checkNotNull(pollId); try { CommentDAO dao = getDAO(Comment.class); List<Comment> result = dao.findAllComments(pollId); return result; } catch (TopiaException e) { throw new PollenTechnicalException("Could not obtain comments", e); } } qui appelle public List<E> findAllComments(String pollId) throws TopiaException { Preconditions.checkNotNull(pollId); String hql = "SELECT e FROM CommentImpl e, PollImpl p WHERE " + "p.pollId = :pollId AND e IN ELEMENTS(p.comment)"; List<E> result = findAllByQuery(hql, "pollId", pollId); return result; } et la c'est le drame :(. La requete qu'il faudrait faire est: select commentimp0_.postDate as postDate5_1_, commentimp0_.author as author6_1_, commentimp0_.poll from public.comment commentimp0_, public.poll pollimpl1_ where pollimpl1_.pollId='5edfa94c043540acbb47f880cc8527bf' and commentimp0_.poll=pollimpl1_.topiaId; Mais on ne peut pas l'ecrire en HQL, car un comment n'a pas de lien vers un poll (le lien est dans l'autre sens) Je propose donc de remplacer le code par PollDAO dao = getDAO(Poll.class); Poll poll = dao.findByPollId(pollId); return poll.comment(); Par contre y'a la meme requete mais paginée :(. Mais je ne suis pas sur qu'elle soit vraiment utilisée. A priori dans le nouveau pollen y'a plus le probleme public class CommentService extends PollenServiceSupport { public List<CommentBean> getComments(String pollId) { checkNotNull(pollId); Poll poll = getPollService().getPoll0(pollId); List<Comment> comments = getCommentDao().forPollEquals(poll).findAll(); return copyAsList(CommentBean.class, comments); } -- Benjamin POUSSIN -------------------- tél: +33 (0) 2 40 50 29 28 email: poussin@codelutin.com http://www.codelutin.com
participants (1)
-
Benjamin POUSSIN