Request: result buffering in ResultSet
Issue #14
resolved
While debugging some perfomance issues in dbmail I narrowed it down to the slow walk thru ResultSet_next, which basically translates to mysql_stmt_fetch(). Documentation for it says that "By default, result sets are fetched unbuffered a row at a time from the server". What I'm observing is a case where query takes 0.05s, returns about 7k rows and then walking thru the ResultSet takes over 15s.
I assume that implementing mysql_stmt_store_result() and necessary memory management would speed this up significantly.
I don't know if other db implementations have similar issue.
Comments (2)
-
repo owner -
repo owner - changed status to resolved
- Log in to comment
The reason we use mysql_stmt_fetch instead of mysql_stmt_store_result is to keep memory usage low. However, it could be interesting to see how much speedup you would gain by storing the result set client-side. If you want to test, I believe you could simply call mysql_stmt_store_result in MysqlResultSet_new after the for-loop doing bind and after adding mysql_stmt_bind_result. If you do test, please let me know the result and also how much the memory usage increased.