Redian新闻
>
java.lang.OutOfMemoryError: Java heap space in DB query
avatar
java.lang.OutOfMemoryError: Java heap space in DB query# Java - 爪哇娇娃
l*b
1
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 tabl
avatar
l*b
2
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 F
avatar
g*g
3
try specify -Xms -Xmx when you start jboss.

get
WHERE

【在 l*****b 的大作中提到】
: 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

avatar
l*b
4
The config values are
-server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.
dgc.server.gcInterval=3600000
Thanks, goodbug
avatar
A*o
5
time for a profiler

rmi.

【在 l*****b 的大作中提到】
: The config values are
: -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.
: dgc.server.gcInterval=3600000
: Thanks, goodbug

avatar
b*y
6
这个SQL好像有脱裤子放P之嫌啊?
难道不可以优化一下吗?
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
==
SELECT *
FROM transactions
WHERE original_transaction_id = '1234' or refenence_tran_id = '1234' order
by
transaction_id

get
WHERE

【在 l*****b 的大作中提到】
: 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

avatar
m*t
7
Your version wouldn't pick up the second row below:
reference_tran_id transaction_id
5555 1234
9898 5555

WHERE

【在 b******y 的大作中提到】
: 这个SQL好像有脱裤子放P之嫌啊?
: 难道不可以优化一下吗?
: 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

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。