experimente problème de performance bizarre sur hibernate,
version hibernate 2.1.3 mais idem avec 2.1.8
pool de cession CP30,
la requete suivante:
select * from ( select sum(depensesvi0_.MONTANT) as x0_0_ from AFF_DEPENSES_V depensesvi0_, AFF_TACHES tache1_, AFF_PROJETS projet2_ where (projet2_.SECTEUR_ID in(0 , 71 , 1619 , 80 , 79 , 1620 , 78) and depensesvi0_.TACHE_ID=tache1_.TACHE_ID and tache1_.PROJET_ID=projet2_.PROJET_ID)and(depensesvi0_.DATE_MOUV>=? )and(depensesvi0_.DATE_MOUV<=? )and(depensesvi0_.PROJET like ? ) order by depensesvi0_.DATE_MOUV desc , upper(depensesvi0_.PROJET)asc , upper(depensesvi0_.TACHE)asc , depensesvi0_.ID_UNIQUE asc ) where rownum <= ?
effectué en direct sur JDBC s'execute en environ 1s, et 50ms sur toad..
avec hibernate elle prend environ 15s , voici les logs
Code:
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.<init> - opened session
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.find - find: select sum( obj.montant) from ortec.oea.bl.model.affaire.depenses.DepensesView obj where obj.tacheRattachee.projet.secteurAgence.id in (0,71,1619,80,79,1620,78) and obj.dateMouvement >= ? and obj.dateMouvement <= ? and obj.projet like ? order by obj.dateMouvement desc ,upper(obj.projet) asc ,upper(obj.tache) asc ,obj.id asc
[][ Finalizer] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.finalize - running Session.finalize()
[][ Finalizer] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.finalize - running Session.finalize()
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.flushEverything - flushing session
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.flushEntities - Flushing entities and processing referenced collections
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.flushCollections - Processing unreferenced collections
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.flushCollections - Scheduling collection removes/(re)creates/updates
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.flushEverything - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.flushEverything - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.SessionImpl.autoFlushIfRequired - Dont need to execute flush
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.BatcherImpl.logOpenPreparedStatement - about to open: 0 open PreparedStatements, 0 open ResultSets
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG net.sf.hibernate.SQL.log - select * from ( select sum(depensesvi0_.MONTANT) as x0_0_ from AFF_DEPENSES_V depensesvi0_, AFF_TACHES tache1_, AFF_PROJETS projet2_ where (projet2_.SECTEUR_ID in(0 , 71 , 1619 , 80 , 79 , 1620 , 78) and depensesvi0_.TACHE_ID=tache1_.TACHE_ID and tache1_.PROJET_ID=projet2_.PROJET_ID)and(depensesvi0_.DATE_MOUV>=? )and(depensesvi0_.DATE_MOUV<=? )and(depensesvi0_.PROJET like ? ) order by depensesvi0_.DATE_MOUV desc , upper(depensesvi0_.PROJET)asc , upper(depensesvi0_.TACHE)asc , depensesvi0_.ID_UNIQUE asc ) where rownum <= ?
[PSERODES][http8080-Processor4] 18/06/2009 18:36:06 DEBUG .sf.hibernate.impl.BatcherImpl.getPreparedStatement - preparing statement
===> jusque ici s'execute correctement
==> la remontée des infos prend au moins 15s
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.BatcherImpl.logClosePreparedStatement - done closing: 0 open PreparedStatements, 0 open ResultSets
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.BatcherImpl.closePreparedStatement - closing statement
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.initializeNonLazyCollections - initializing non-lazy collections
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.flushEverything - flushing session
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.flushEntities - Flushing entities and processing referenced collections
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.flushCollections - Processing unreferenced collections
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.flushCollections - Scheduling collection removes/(re)creates/updates
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.flushEverything - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.flushEverything - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.execute - executing flush
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.postFlush - post flush
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.afterTransactionCompletion - transaction completion
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.close - closing session
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.disconnect - disconnecting session
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 DEBUG .sf.hibernate.impl.SessionImpl.afterTransactionCompletion - transaction completion
[PSERODES][http8080-Processor4] 18/06/2009 18:36:14 INFO Performance.findObjects - tps:[7462]ms, size:[1], query:[select sum( obj.montant) from ortec.oea.bl.model.affaire.depenses.DepensesView obj where obj.tacheRattachee.projet.secteurAgence.id in (0,71,1619,80,79,1620,78) and obj.dateMouvement >= ? and obj.dateMouvement <= ? and obj.projet like ? order by obj.dateMouvement desc ,upper(obj.projet) asc ,upper(obj.tache) asc ,obj.id asc ]
il semblerait que l'utilisation directe de JDBC soit plus rapide que l'utilisation à travers hibernate pourtant le traitement est le même execution d'un preparedStatement.