-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Big Performance problem with setParameterList()
PostPosted: Tue Jul 19, 2005 9:12 am 
Newbie

Joined: Tue Jul 12, 2005 9:06 am
Posts: 7
Here is a simple code :

Code:
    int nb=16;
    for (int j = 0; j < 50; j++) {
      idDocs = new Integer[nb];
      for (int i = 0; i < idDocs.length; i++) {
        idDocs[i] = new Integer(i + 1);
      }
      long deb = System.currentTimeMillis();
      SQLQuery query = getSession().createSQLQuery(
            "select {R.*} from placedentities R where R.idDoc in (:docs) ");
      query.addEntity("R", PlacedEntity.class);
      query.setParameterList("docs",idDocs);

     System.out.println("nb doc:"+nb
            +"\ttime="+(System.currentTimeMillis()-deb));
      nb*=2;
    }


Thsi gives this result :
Code:
...
nb docs:64                 time=16
nb docs:128               time=62
nb docs:256               time=32
nb docs:512               time=281
nb docs:1024             time=609
nb docs:2048             time=2219
nb docs:4096             time=8938
nb docs:8192             time=34140


And I stop to wait for nb docs=16384 after 6 minutes

I saw that it is method SQLQueryParser.substituteParams that takes so much time, not the query.

I prevent this by making my own query substitution

Hibernate version:3.0


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 19, 2005 10:59 am 
Newbie

Joined: Tue Jul 12, 2005 9:06 am
Posts: 7
Oups, I forgot query.list() call. Code is :

Code:
    int nb=16;
    for (int j = 0; j < 50; j++) {
      idDocs = new Integer[nb];
      for (int i = 0; i < idDocs.length; i++) {
        idDocs[i] = new Integer(i + 1);
      }
      long deb = System.currentTimeMillis();
      SQLQuery query = getSession().createSQLQuery(
            "select {R.*} from placedentities R where R.idDoc in (:docs) ");
      query.addEntity("R", PlacedEntity.class);
      query.setParameterList("docs",idDocs);

      query.list()

      System.out.println("nb doc:"+nb
            +"  time="+(System.currentTimeMillis()-deb));
      nb*=2;
    }


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 19, 2005 8:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Are you sure????


If you are really sure about this, submit to JIRA. I find it pretty difficult to believe.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 20, 2005 4:10 am 
Newbie

Joined: Tue Jul 12, 2005 9:06 am
Posts: 7
gavin wrote:
Are you sure????


If you are really sure about this, submit to JIRA. I find it pretty difficult to believe.


Yes I am sure :-( . I have just posted it to Jira


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.