hibernate跟jdbc的查詢速度相差10???
我按照robbin的程式測試。
查詢1000條紀錄:(hibernate使用list)
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 311ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 1362ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 461ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 70ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 631ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 70ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 80ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 441ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 270ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 70ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 461ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 50ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 70ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 591ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 60ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 60ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 591ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 60ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 80ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 441ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 50ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 210ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 461ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 80ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 60ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 591ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 50ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 70ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 441ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 60ms
//////////////還有ms的驅動也不是很差阿。
而如果查詢100條紀錄,在cat.hbm.xml增加jcs-cache usage="read-only"
而hibarenate改成
Iterator iter = q.iterate();(是不是這樣用jcs??)
測試結果
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 80ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 862ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 230ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 20ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 641ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 20ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 40ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 701ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 20ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 681ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 20ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 561ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 60ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 541ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 0ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 681ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 0ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 10ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 571ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 10ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 561ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 0ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 10ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 551ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 0ms
/////////////////為什麼呢?hibernate我用的是jsql的驅動。
查詢1000條紀錄:(hibernate使用list)
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 311ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 1362ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 461ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 70ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 631ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 70ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 80ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 441ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 270ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 70ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 461ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 50ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 70ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 591ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 60ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 60ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 591ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 60ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 80ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 441ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 50ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 210ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 461ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 80ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 60ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 591ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 50ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 70ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 441ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 60ms
//////////////還有ms的驅動也不是很差阿。
而如果查詢100條紀錄,在cat.hbm.xml增加jcs-cache usage="read-only"
而hibarenate改成
Iterator iter = q.iterate();(是不是這樣用jcs??)
測試結果
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 80ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 862ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 230ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 20ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 641ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 20ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 40ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 701ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 20ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 681ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 20ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 561ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 60ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 541ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 0ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 681ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 0ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 10ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 571ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 10ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 0ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 561ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 0ms
Start Reading Records with JSQL JDBC...
Finished Reading Records with JSQL JDBC: 10ms
Start Reading Records with Hibernate...
Finished Reading Records with Hibernate: 551ms
Start Reading Records with MS JDBC...
Finished Reading Records with MS JDBC: 0ms
/////////////////為什麼呢?hibernate我用的是jsql的驅動。
相關文章
- Hibernate 查詢
- Hibernate查詢方式
- Hibernate——Query查詢
- Hibernate 框架的查詢方式框架
- 提高sql查詢速度SQL
- 提高count查詢速度
- 一個使用JDBC按Date查詢查詢的問題JDBC
- jdbc如何連續查詢?JDBC
- hibernate中hql查詢
- Hibernate hql 多表查詢
- Hibernate 查詢語句
- hibernate的三種查詢方式
- hibernate查詢的方式 都有哪些
- Hibernate的查詢方式與策略
- hibernate的native sql查詢SQL
- Hibernate的Criteria查詢問題。
- hibernate的查詢快取薦快取
- 優化sql查詢速度優化SQL
- 提高查詢速度使用materizlizedZed
- win10如何查詢自己寬頻速度_win10檢視寬頻速度的方法Win10
- Hibernate 之強大的HQL查詢
- 關於Hibernate的查詢問題
- Hibernate查詢自動更新
- Hibernate連線查詢join
- hibernate 動態查詢(DetachedCriteria )
- hibernate批量查詢問題
- hibernate(七) hibernate中查詢方式詳解
- Hibernate通常是三種:hql查詢,QBC查詢和QBE查詢:
- 391、Java框架46 -【Hibernate - 查詢HQL、查詢Criteria、查詢標準SQL】 2020.10.19Java框架SQL
- Hibernate-ORM:13.Hibernate中的連線查詢ORM
- 提高查詢速度方法總結
- 優化sql提高查詢速度優化SQL
- hibernate的hql查詢語句總結
- Hibernate 分頁查詢的一點疑惑
- Hibernate實現分頁查詢的原理
- 查詢跟蹤檔名稱
- JDBC 與 Hibernate 共存JDBC
- 一個小操作,SQL查詢速度翻了1000倍。SQL