![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I enabled profileSql=true and noticed: Query "SET autocommit=1" execution time: 33 Query "SET autocommit=1" execution time: 36 Query "SELECT * FROM FEED WHERE ID = '1'" execution time: 37 result set fetch time: 0 What's with all the autocommits? Isn't this redundant on MyISAM tables?. Is there any way to disable this via the connection URL? Doesn't look like it: http://dev.mysql.com/doc/connector/j...html#id2801179 Kevin FYI... this was because we were using connection pooling. Our |
|
/** Has autocommit already been set for this connection? */ private boolean hasAutoCommit = false; 509a512,517 //prevent duplicate autocommit settings which will just slow our //connection to the server if ( hasAutoCommit && this.autoCommit == autoCommit ) return; 515d522 |
|
hasAutoCommit = true; 2724d2732 |
#3
| |||
| |||
|
|
Kevin Burton wrote: I enabled profileSql=true and noticed: Query "SET autocommit=1" execution time: 33 Query "SET autocommit=1" execution time: 36 Query "SELECT * FROM FEED WHERE ID = '1'" execution time: 37 result set fetch time: 0 What's with all the autocommits? Isn't this redundant on MyISAM tables?. Is there any way to disable this via the connection URL? Doesn't look like it: http://dev.mysql.com/doc/connector/j...html#id2801179 Kevin FYI... this was because we were using connection pooling. Our persistence layer kept calling setAutoCommit( true ) which kept sending this to the server. The attached patch makes Connection.java smarter and if it's already been sent and it's the same value we don't resend it. Should be simple and clean... Thoughts on this guy? ------------------------------------------------------------------------ 46d45 203a203,205 /** Has autocommit already been set for this connection? */ private boolean hasAutoCommit = false; 509a512,517 //prevent duplicate autocommit settings which will just slow our //connection to the server if ( hasAutoCommit && this.autoCommit == autoCommit ) return; 515d522 548a556,557 hasAutoCommit = true; 2724d2732 3129d3136 |
#4
| |||
| |||
|
|
Kevin, It might be interesting, but at first glance it doesn't appear that this patch 'knows' if auto commit has been set _outside_ of the JDBC calls... Oh... is there a difference if the com.mysql.* classes have set |
|
the only 'safe' way to know this is to issue it explcitly. It is issued... but we just remove duplicate SET AUTOCOMMIT=true... |
|
This also seems like a premature optimization, are you _really_ sure the sub-ms call to setAutoCommit() is causing your application to be slower, compared to query optimization, caching, etc that you could do that generally have orders-of-magnitude performance improvement possibilities? Oh no... let me make it clear... this isn't a HUGE performance hit it's |
![]() |
| Thread Tools | |
| Display Modes | |
| |