Can I limit the size of the returned ResultSet without RowBounds

87 views
Skip to first unread message

Zhang Lei

unread,
May 25, 2021, 5:56:19 AM5/25/21
to mybatis-user
Hi, All

In order to avoid OOM caused by returning large result sets, I want to provide a global limit parameter.

Throw an exception when the returned collection is greater than this limit

The limit should help me avoid system crashes caused by any silly mistakes

Can I implement this judgment in the following code? Or any suggestions?

Biao Huang

unread,
May 27, 2021, 5:55:09 AM5/27/21
to mybati...@googlegroups.com
Try to use MyBatis new feature Cursor to select huge data.

Zhang Lei <coolb...@gmail.com> 于2021年5月25日周二 下午5:56写道:
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/fc01df63-c3f0-427e-a288-6f6d3bbd6446n%40googlegroups.com.


--
=====================================
QQ:     26664141
Skype: biao.mac
EMail:  biao...@gmail.com

Tel: Home:  495312217000
Tel: Mobile: 4917620793369

Erwan Letessier

unread,
May 28, 2021, 3:25:07 AM5/28/21
to mybati...@googlegroups.com
Set value for either "fetchSize" property in select statement or "defaultFetchSize" in global config. 
Value is null by default, then driver dependent. E.g: Only 10 with Oracle and unlimited with Postgres.


Reply all
Reply to author
Forward
0 new messages