| Author |
java.lang.OutOfMemoryError: Java heap space in DB query
|
Sky Loi
Ranch Hand
Joined: Oct 06, 2008
Posts: 65
|
|
I use Spring JdbcTemplate to do the following query and use RowMapper to get the ResultSet. However, the Jboss server generate java.lang.OutOfMemoryError some time.
SELECT *
FROM transactions
WHERE transaction_id = (SELECT refenence_tran_id FROM transactions WHERE transaction_id = '1234')
or transaction_id = (SELECT original_transaction_id FROM transactions WHERE transaction_id = '1234')
or original_transaction_id = '1234' or refenence_tran_id = '1234' order by transaction_id
Notes:
1. The table transactions is a very big table
2. I have set all index for columns transaction_id, refenence_tran_id and original_transaction_id.
3. The query usually return 2-3 result rows
4. Seems the java.lang.OutOfMemoryError happened in high load
My concern is why there is memory error for this query with just quite a few result sets. Any wrong with my query syntax above? Thank you for your help in advance.
|
 |
Sky Loi
Ranch Hand
Joined: Oct 06, 2008
Posts: 65
|
|
The whole error log is:
INFO [org.springframework.jdbc.support.SQLErrorCodesFactory] SQLErrorCodes loaded: [DB2, HSQL, MS-SQL, MySQL, Oracle, Informix, PostgreSQL, Sybase]
ERROR [STDERR] com.active.dao.DAOException: An exception occurred during database access: PreparedStatementCallback; uncategorized SQLException for SQL [SELECT * FROM transactions WHERE transaction_id = (SELECT refenence_tran_id FROM transactions WHERE transaction_id = ?) or transaction_id = (SELECT original_transaction_id FROM transactions WHERE transaction_id = ?) or original_transaction_id = ? or refenence_tran_id = ? order by transaction_id]; SQL state [null]; error code [0]; Error; - nested throwable: (java.lang.OutOfMemoryError: Java heap space); nested exception is org.jboss.util.NestedSQLException: Error; - nested throwable: (java.lang.OutOfMemoryError: Java heap space)
.........
|
 |
John Kimball
Ranch Hand
Joined: Apr 13, 2009
Posts: 96
|
|
Do you have a log of the exact query/parameter that runs, when you get an out of memory error?
And what happens if you run the same error-generating query directly, using a SQL querying tool?
Or maybe you have a memory leak somewhere else in the application.
Is this the ONLY place where you get an out of memory error?
|
 |
 |
|
|
subject: java.lang.OutOfMemoryError: Java heap space in DB query
|
|
|