Question of defualtFetchSize

66 views
Skip to first unread message

yang yu

unread,
Oct 26, 2020, 7:43:20 AM10/26/20
to mybatis-user
Set defualtFetchSize=-2147483648 in jdbcUrl, and do not configure defualtFetchSize in the mapper or mybatis configuration file. Should streaming query take effect?

At present, from the test, if you do this, the streaming query does not take effect, I want to confirm

Iwao AVE!

unread,
Oct 26, 2020, 1:37:18 PM10/26/20
to mybatis-user
Hello Yang,

Specifying defaultFetchSize=-2147483648 in JDBC URL should enable the streaming resultset feature, with the recent versions at least.
If you still have difficulty with verifying it, please show us how you test it.

Regards,
Iwao

On Mon, Oct 26, 2020 at 8:43 PM yang yu <yuy...@pingcap.com> wrote:
Set defualtFetchSize=-2147483648 in jdbcUrl, and do not configure defualtFetchSize in the mapper or mybatis configuration file. Should streaming query take effect?

At present, from the test, if you do this, the streaming query does not take effect, I want to confirm

--
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/e1f599ff-ed18-4a71-a438-dc9ce2df902dn%40googlegroups.com.
Message has been deleted

yang yu

unread,
Oct 27, 2020, 3:00:29 AM10/27/20
to mybati...@googlegroups.com
thx
A few days ago, the test found that the streaming query did not take effect (fetchsize=0). The situation is that the defaultfetchsize is not set in mybatis, but only set in jdbcurl. After deleting the defaultfetchsize of jdbcurl, and adding the defaultfetchsize to mybatis configration, it took effect, which is very strange. Version information: mybatis 3.4.4, jdbc 5.1.36

Iwao AVE!

unread,
Oct 27, 2020, 1:19:27 PM10/27/20
to mybatis-user
So, how do you verify if the result set is streamed or not?
Could you share your test case or demo project?


yang yu

unread,
Oct 30, 2020, 10:34:49 PM10/30/20
to mybati...@googlegroups.com
Because the use of streaming query still causes the client server to oom, check the hprof file and find that fetchsize=0

Iwao AVE!

unread,
Oct 30, 2020, 11:35:54 PM10/30/20
to mybatis-user
OK...here is how I tested.

I set a breakpoint on org.apache.ibatis.executor.statement.PreparedStatementHandler#query() and run the test case below in debug mode.

defaultFetchSize=-2147483648 is set in the JDBC URL.

And the actual fetchSize is -2147483648.

image.png

I didn't check if the result set is actually being streamed or not, but if you see fetchSize=0, it may be set by something else.

Regards,
Iwao

yang yu

unread,
Oct 31, 2020, 1:24:19 AM10/31/20
to mybati...@googlegroups.com
Thank you very much for your patience. I read your code, it is a simple demo, but I am currently using springboot + mybatis + hikari architecture, I debugged the query() method, because I used hikari, the statement is HikariProxyPrepareStatement, no I found the fetchsize property, and I think the streaming query did not take effect. I wonder if this has anything to do with the connection pool like c3p0 or hikari ?

2020年10月31日 上午11:35,Iwao AVE! <hara...@gmail.com> 写道:

OK...here is how I tested.

I set a breakpoint on org.apache.ibatis.executor.statement.PreparedStatementHandler#query() and run the test case below in debug mode.

defaultFetchSize=-2147483648 is set in the JDBC URL.

And the actual fetchSize is -2147483648.

<image.png>

I didn't check if the result set is actually being streamed or not, but if you see fetchSize=0, it may be set by something else.

Regards,
Iwao

On Sat, Oct 31, 2020 at 11:34 AM yang yu <yuy...@pingcap.com> wrote:
Because the use of streaming query still causes the client server to oom, check the hprof file and find that fetchsize=0

 
--
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.

Iwao AVE!

unread,
Oct 31, 2020, 7:50:40 AM10/31/20
to mybatis-user
I assumed that you got the expected result when you set fetchSize=-2147483648 in a mapper or MyBatis configuration, but that was not the case, right?
If you want to process result objects one by one, you need to use Cursor.

There are a few tests in the following directory.

Regards,
Iwao

Reply all
Reply to author
Forward
0 new messages