Slow « Query « JPA Q&A





1. How do I do this query using JPA so that it is not very slow?    stackoverflow.com

How do you join across multiple tables in an efficient way using JPQL

select a.text,b.text,c.text,
from Class1 a, Class2 b, Class3 c
where a.id=b.b_id and b.id=c.b_id and a.text like ... and b.text like ...
I ...

2. CriteriaQuery slow only for a given entity - Hibernate    stackoverflow.com

when I use Hibernate and Criteria Query I have a very strange behaviour for only a given entity. I have the following structure

Enitity Parent
Enitity FirstChild
Enitity SecondChild
Enitity ThirdChild
Very surprisingly, when I query ...

3. Simple hibernate query beeing very slow    stackoverflow.com

I have the following hibernate query:

Query query = session.createQuery("from MyHibernateClass");
List<MyHibernateClass> result = query.list();// executes in 7000ms
When logging the sql being executed in MySQL I see
select 
  myhibernat0_.myFirstColumn as myfirstcolumn92_, 
 ...

4. Problem with slow hql query in grails app    stackoverflow.com

I have this hql query but it takes so long (10 minutes) to be executed since its basically sweep the whole table. I was wondering if there is other way to ...

5. JPA slow on remote database queries    forums.netbeans.org

csaffi Joined: 18 May 2009 Posts: 39 Posted: Mon Apr 19, 2010 7:25 am Post subject: JPA slow on remote database queries I hope you can help me ...

6. Hibernate query is slow    coderanch.com

As far as I know there is no way to "pre-issue" SQL from Hibernate to the database before the first query you can bypass that by using stored functions/procedures. The general performance guidelines are: Tune you SQL or tune your HQL to generate the best SQL; enlist the help of a DBA and/or consult something like SQL Tuning to come ...

7. Hibernate insert causes many select statements - slow :(    coderanch.com

Well, your mapping will have an affect on how that runs. But first, I would choose to use session.saveOrUpdate() instead of calling insert(). The second is how deep do you need to keep that object filled. You could make a different instance, that is only as deep as you need it to be, to be inserted and/or updated. (cascade options also ...

8. Hibernate. database response is slow even for single record query    coderanch.com

When I am using large database, even a single record query takes a long time to be retrieved from the database. Example: Select user from user where id=10 . Here id is a primary key. I have done indexing based on the queries I need, even these queries are getting slow as the size of the database and table grows. Have ...

9. Hibernate slow on refresh    coderanch.com

Well, moving swiftly on to transactions now, armed with Java Persistence with Hibernate. Being new to this its probably not too surprising that its much, much slower than my handcoded JDBC stuff, unfortunately. It is quite a simple app really as far as the data is concerned, single user only. To that end, having the app open is considered one 'conversation' ...





10. Hibernate - Slow Query on Entity Superclass    coderanch.com

Hi Guys I have a quick question regarding Hibernate entity mappings. I have a Java project in NetBeans, using Hibernate as persistence manager, with all the default settings. I have two entity classes in my application; each of them extends the same superclass. When executing a select query on the superclass, it takes around two and a half minutes. When executing ...

11. JPQL Query suspiciously slow    java.net

12. Query with Oracle Contains function is slow    forum.hibernate.org

Newbie Joined: Thu Oct 01, 2009 11:43 pm Posts: 1 Hi All I have 2 million records in my table. I am using Oracle 10g as database, Spring 2.5.5 as application and hibernate 3.2 . My query is taking about 22 seconds when I use hibernate, however when I use the query in SQL developer it takes only 1-2 seconds. My ...

13. Query response is very slow.....    forum.hibernate.org

Hi , I did check the query response time. Response time is less than a second. ( Just i executed select sysdate from dual ). But when i execute this query and debug through eclipse Code: select MSA, HPI, ...

14. Strange behavior when using .find(id) (Very very slow)    forum.hibernate.org

Hi all! I built a test that looks as follows: Code: @Test public void test_SearchAndFind() throws Exception { LeadDAO leadDAO = (LeadDAO) applicationContext.getBean("leadDAOBean"); UUID uuid = UUID.fromString("d7ead80f-8b2f-4dd8-8c37-bb29f9382286"); ...

15. Very slow query using LIKE with hibernate but fast direct    forum.hibernate.org

Hi, I've got a strange behaviour. I've got a very simple select statement SELECT d.someVal from PoDetails d where d.val LIKE 'SOMETHING' If I execute this against a very large Progress db table it takes about 65 seconds using Hibernate (tested with the HQL Editor in Eclipse) while the same query takes about 1-3 seconds with SquirreL (not due to caching, ...

16. hibernate select query slow    forum.hibernate.org

Hello, at first sorry for my bad english, just for the information, i posted the same question in the german form. my queistion is considering the hibernate performance: i have read that hibernate isnt such fast as sql, on the other side it does a lot of job for you, you would have to do manually with sql. but is it ...





17. Upgrading 3.3.1 to 3.5.0, getting very slow queries    forum.hibernate.org

Hi, I've been spending some time investigating whether our application can be upgraded to use Hibernate 3.5.0 (from 3.3.1). I've found that one particularly query (14 joins) that worked fine and fast in the old Hibernate now joins 23 tables (the same, though many are joined twice) and this makes MySQL (5.1) choke (8.5 minutes to do an explain vs. instantly ...

18. Slow query - every 10 records something delays the progress    forum.hibernate.org

Hi all, I ran several tests with em.createNativeQuery, where I select 1000 records from a table in Oracle. The query takes about 10s to finish. The same query run in pl/sql developer takes about 2.0 seconds. This is a massive difference. As you see in the trace, there are delays of about 100ms. They appear always at the same place and ...

19. Extremely slow query    forum.hibernate.org

Author Message mansica Post subject: Extremely slow query Posted: Wed Nov 03, 2010 3:37 am Newbie Joined: Wed Nov 03, 2010 3:14 am Posts: 1 When I run a query with hibernate I get this log: Code: [DEBUG] [13:17:37,207] [cappman] Search started [DEBUG] [13:17:37,222] [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0) [DEBUG] [13:17:37,222] [SQL] select count(*) ...

20. Query from hibernate running slow    forum.hibernate.org

21. Select Count(*) Very Slow    forum.hibernate.org

Hi Guys i have a problem and i need help i am hibernate newbie.. i am doing a small Java ee aplication. i am doing a Select count(*) from a bunch of tables but is very slow.. here is my code.. Code: ...

22. Urgent: How to optimize this SLOW query?    forum.hibernate.org

Newbie Joined: Sun Apr 25, 2004 12:42 pm Posts: 2 Hi there, newbie here. I'm doing a project where we have, among others, 2 tables in a database (DB2 8.1 using legacy CLI JDBC driver): "Paper" and "Quote". As you might've guessed, the paper-table contains information about stock papers, whereas the quote-table contains streaming quotes for the papers. The two tables ...

23. Custom user type causes update and VERY slow query    forum.hibernate.org

I have a system where a number of entities represent the ids os objects which never change and may be cached in an application (imagine state abbreviations or a product catalog). When I declare these references as many-to-one associations hibernate does a join which is slow. Instead I developed a UserType which converts an id to an object held in application ...

24. Count Query Slow in Hibernate, Fast in JDBC    forum.hibernate.org

Hibernate 2.1.4 Sybase 12.5 When I run this select count(*) via hibernate it takes a long time. Over 2 minutes. When I run the EXACT same query that hibernate generates, just via JDBC it runs as expected, less than a second. (I ran this test in the same place I ran the hibernate query, even retrieved the Connection via the same ...

25. Queries Slow when Session Cache Large    forum.hibernate.org

Thanks Anthony, Basically, we load data from table a (one record), and dependant tables b and c (20,000 records each). It is a total of approximately 40,000 records. We iterate over the 20,000 records from table b, performing some validations and some calculations and frequently but not always updating the corresponding records from table c. There is a fourth table, table ...

26. Query Very Slow    forum.hibernate.org

Newbie Joined: Thu Feb 03, 2005 5:49 am Posts: 19 Hello there. I'm using a query which returns 17 thousands records. (the one called AVCD_VCDAWB_FINDBY_PAIS_FECLIQUIDACION) It takes about 30 seconds in order to finalize. All the necesary indexes have been created. is there something in the mapping that I could change in order to improve the query? Thanks in advanced. Hibernate ...

27. Slow queries with postgres    forum.hibernate.org

If I manually type a query into psql it is as would be expected as described in the 'User Comments' section of the page So something like SELECT record WHERE record.an_id=11111 returns a query plan that doesn't use the index on 'an_id', whereas: SELECT record WHERE record.an_id='11111' returns a query that does use an index The hibernate object I am having ...

28. Hibernate queries are slow    forum.hibernate.org

29. slow query    forum.hibernate.org

Hibernate version: 3.0 Mapping documents: NA Code between sessionFactory.openSession() and session.close(): Full stack trace of any exception that occurs: NA Name and version of the database you are using: Oracle 9i The generated SQL (show_sql=true): select count(*) as y0_ from A.TableA this_ where this_.IS_ACTIVE = 'Y' and (this_.Column1 like ? or this_.Column1 like ? or this_.Column1 like ?) Debug level Hibernate ...

30. 2nd Level Cached Query - 1st super slow, 2nd super fast    forum.hibernate.org

Page 1 of 1 [ 9 posts ] Previous topic | Next topic Author Message fischman_98 Post subject: 2nd Level Cached Query - 1st super slow, 2nd super fast Posted: Thu Jul 27, 2006 2:29 pm Beginner Joined: Thu May 18, 2006 2:58 pm Posts: 25 I am querying a single ...

31. Slow query executed when executing a delete    forum.hibernate.org

Hi, I have a program which stores 2 types of orders: RetailOrder and SupplierOrder. They both inherit from the abstract class Order. Order has a one-to-many link to an OrderLine which is an abstract class of RetailOrderLine and SupplierOrderLine. Now when I delete an order I want all the orderlines to be removed so cascade is set to "all-delete-orphan". The code ...

32. Queries slow with more intialised entities during transactio    forum.hibernate.org

Newbie Joined: Thu Jun 22, 2006 12:11 am Posts: 14 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.2.2.GA Code between sessionFactory.openSession() and session.close(): Code: session.beginTransaction(); for (Campaign camp : campaigns) { for (Lot lot : (Set)camp.getLots()) { ...

34. Why is it so slow? - Query table    forum.hibernate.org

Hibernate version: 3.2.2 Mapping documents: Code: Guida processi - Unita organizzative

35. When Database is large,even single record queries are slow    forum.hibernate.org

What do your selects look like? Select u from user where id=10 . Here id is a primary key How do your indexes look like? I have done indexing based on the queries I need, even these queries are getting slow as the size of the db and table grows. Is your db actually using the db

36. native query very slow    forum.hibernate.org

Hibernate version: 3.1.3 String sql = "select c.id as {c.id} from table s where s.field1 = :param or :param is null"; Query q = session.createSQLQuery(sql).addEntity("c",MyClass.class); q.setParameter("param ",param ==null?"":param); List list = q.list(); oracle 10 mytable includes 7 million row. field1 indexed. but it runs than very very slow response. but i changed sql (:param is null -> 'bla' is null): String ...

37. [SOLVED] A rather simple query which executes slow...    forum.hibernate.org

I've got a rather simple HQL query. This query retrieves about 4000 entities from a database. The query takes 2656 ms. to execute with Hibernate, but only 110 ms. when i execute the translated SQL query through a MySQL database tool. 1. I've tried to remove everything that has to do with subclassing in the mapping file. No performance improvement. 2. ...

38. Criteria query pagination very slow with Derby    forum.hibernate.org

I'm seeing significant delays when using Hibernate (3.3.2) in combination with Derby (10.5.1) and attempting to paginate my query results. When setting setMaxResults(1), I'm seeing a 15 second delay from the time I execute the .list() until the result set (instance) is returned. (Note - this is a query on a very simple table schema no relationships to other tables). I've ...