-->
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.  [ 2 posts ] 
Author Message
 Post subject: Abfrage über H extrem langsam, sonst schnell
PostPosted: Fri Jul 13, 2007 7:47 am 
Newbie

Joined: Mon Sep 18, 2006 5:47 am
Posts: 9
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0
Mapping documents:
<hibernate-mapping>
<class name="Refererdata" table="refererdata" schema="public">
<id name="refererdataid" type="long">
<column name="refererdataid" />
<generator class="assigned" />
</id>
<property name="counttimeaslong" type="java.lang.Long" index="idx_counttimeaslong">
<column name="counttimeaslong" />
</property>
<property name="counttimeastimestamp" type="timestamp">
<column name="counttimeastimestamp" length="29" />
</property>

<property name="usersession" type="string">
<column name="usersession" />
</property>
</class>
</hibernate-mapping>

<sql-query name="sql.average.pis" >
<return-scalar type="big_decimal" column="av"/>
select avg(temp.quantity) as av from
(
select usersession, count(*) as quantity from refererdata
where counttimeaslong between ? and ?
group by usersession
) as temp
</sql-query>


Name and version of the database you are using:
Postgre 8.2

The generated SQL (show_sql=true):
select avg(temp.quantity) as av from
(
select usersession, count(*) as quantity from refererdata
where counttimeaslong between ? and ?
group by usersession
) as temp



Diese Abfrage dauert über Hibernate ca. 40 Sekunden (die Tabelle ist sehr gross). Wenn ich die selbe Query direkt im Query Browser von Postgres ausführe dauert die nur ca. 3-5 Sekunden

auf counttimealong liegt folgender index:
CREATE INDEX idx_counttimeaslong
ON refererdata
USING btree
(counttimeaslong);

Mit meinem begrenzten Wissen über Hibernate kann ich nur vermuten, dass er den index ignoriert oder das caching vielleicht falsch eingestellt ist (benutze die Standardwerte).

Hat jemand eine Idee, welchen Schalter ich umlegen muss, um hibernate entsprechend schneller zu machen?

viele Grüsse und besten Dank im voraus


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 13, 2007 11:22 am 
Newbie

Joined: Mon Sep 18, 2006 5:47 am
Posts: 9
gelöst:

Die Parameter müssen als Long übergeben werden, nicht als String


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.