1. 程式人生 > >mysql jdbc原始碼分析總結

mysql jdbc原始碼分析總結

效能殺手:StatementImpl.setMaxRows(int),會返回max之前的所有資料,不像limit offset會跳過offset之前的行,不建議使用
RowDataCursor(多次傳送command,佔小記憶體,略慢,臨時表)RowDataDynamic(一次傳送command,佔小記憶體,最快,該connection不能同時查詢,鎖表)RowDataStatic(預設使用,一次載入全部,佔大記憶體)MysqlIO.readSingleRowSet()


RowDataCursor(多次傳送command,佔小記憶體,略慢,臨時表)


RowDataStatic(預設,一次載入全部,佔大記憶體)


效能殺手:StatementImpl.setMaxRows(int)

批量更新:rewriteBatchedStatements
沒有設定rewriteBatchedStatements=true,效能差,多次更新設定rewriteBatchedStatements=true,效能好,1次更新,insert values (), ()設定rewriteBatchedStatements=true,效能一般,1次更新,insert value();insert value();

獲取連線: