我有一個連接到數據庫的Java應用程序。在生產環境中,數據集非常大,所以應用程序非常慢,我想在開發環境中模擬(緩慢)。有沒有辦法,如何減慢mysql,所以響應時間更長?
我知道,我可以放大我的測試數據集,但大數據集的處理會佔用處理器週期,我寧願在MySQL
中尋找「便宜」sleep
s。mysql故意放緩
0
A
回答
0
MySQL有一個SLEEP(duration)
輔助功能,其中duration是秒數。
來源:http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_sleep
0
您可以MySQL數據庫文件複製到(慢,舊)USB閃存盤,並設置MySQL的設置DATADIR指向USB。我將MySQL數據目錄複製到USB密鑰並將datadir變量設置爲USB。
#Path to the database root
#datadir="C:/Program Files (x86)/MySQL/MySQL Server 5.0/Data/"
datadir = "E:/data"
我猜想的innodb_flush_log_at_trx_commit設置爲1
# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1
這樣每次更新,刪除,插入語句會導致I/O沖洗是很重要的。
0
要添加到SLEEP()函數評論,下面是睡眠集成到任何SQL查詢時,您不能運行它作爲單獨的聲明一個簡單的方法:
LEFT JOIN (SELECT SLEEP(30)) as `sleep` ON 1=1
相關問題
- 1. 故意延緩動態模板
- 2. 如何故意緩和工作
- 3. COM對象被釋放非故意
- 4. 如何故意破壞MySQL表?
- 5. Python MySQL-查詢被意外緩存
- 6. NHibernate緩存故障
- 7. 在AppEngine上故意緩慢加載Python應用程序
- 8. 故意緩衝區溢出漏洞利用程序
- 9. 我如何故意從主內存讀取緩存?
- 10. 故意組合環
- 11. 故意減慢HttpListener
- 12. MySQL索引的放緩查詢
- 13. ASP.NET MVC故意的Ajax故障
- 14. MySQL STR_TO_DATE故障?
- 15. 故意無意義MIME類型
- 16. 用於排除意外的mysql查詢故障的技巧
- 17. 故意發送403響應
- 18. 故意崩潰內核
- 19. Java代碼故意虎CPU
- 20. 如何故意拋出RuntimeException?
- 21. AlarmManager的意圖故障
- 22. 意外分段故障
- 23. 故意忽略連字符
- 24. 故意散列衝突
- 25. 故意暫停JSP加載
- 26. 故意生成javascript錯誤
- 27. Valgrind標記故意泄漏
- 28. MySQL查詢故障
- 29. 故障使用MYSQL
- 30. MySQL登錄故障
的MySQL實際上有睡眠:HTTP ://stackoverflow.com/questions/4284524/how-and-when-to-use-sleep-correctly-in-mysql – Konerak