SQL最佳化 —— 讀懂執行計劃
Bucket and Batch
I saw that functions which use hash join, like as ExecHashGetBucketAndBatch and ExecScanHashBucket, have bucket and batch concepts. So, I would like to know the differences between bucket and batch. I dont understand tables partitioning mechanism in hash join.
A bucket is, well, one bucket of a hash table --- it holds all the tuples that have the same hash code (for as many bits of the hash code as we are choosing to use). We try to size the hash table with enough buckets so there's not more than 10 tuples per bucket on average. A batch is a range of buckets that we process at the same time. Tuples (from either side of the join) whose hash codes show they fall into batches other than the first one get dumped into temporary holding files, and then (after finishing joining the first batch) we pull each successive batch back into memory and join that portion of the tuples. The batch size is chosen to make the amount of memory needed be approximately work_mem. IOW, there are really nbuckets * nbatches "virtual" buckets in the hash table, but only nbuckets worth of them are kept in memory at any one time.
Note that we don't currently do batches for hash aggregates, only joins currently.
show Heap Fetches in EXPLAIN for index-only scans
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26477398/viewspace-2128499/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 讀懂MySQL執行計劃MySql
- SQL最佳化案例-從執行計劃定位SQL問題(三)SQL
- spark sql語句效能最佳化及執行計劃SparkSQL
- Oracle sql執行計劃OracleSQL
- 微課sql最佳化(9)、如何獲取執行計劃SQL
- 微課sql最佳化(11) 、如何檢視執行計劃SQL
- Calcite執行計劃最佳化
- Mysql SQL最佳化系列之——執行計劃連線方式淺釋MySql
- 如何檢視SQL的執行計劃SQL
- SQL 執行 - 執行器最佳化SQL
- Oracle SQL Profile固定執行計劃的方法OracleSQL
- SQL最佳化案例-改變那些CBO無能為力的執行計劃(一)SQL
- 不會看 Explain 執行計劃,勸你簡歷別寫熟悉 SQL 最佳化AISQL
- 執行計劃-1:獲取執行計劃
- MySQL——通過EXPLAIN分析SQL的執行計劃MySqlAI
- SQL優化案例-從執行計劃定位SQL問題(三)SQL優化
- 一圖讀懂FISCO BCOS MVP計劃MVP
- .Oracle固定執行計劃之SQL PROFILE概要檔案OracleSQL
- SQL執行計劃異常引起的效能問題SQL
- SQL執行計劃異常 引起的效能問題SQL
- SQLServer統計監控SQL執行計劃突變的方法SQLServer
- 分析執行計劃優化SQLORACLE的執行計劃(轉)優化SQLOracle
- 一文讀懂一條 SQL 查詢語句是如何執行的SQL
- 獲取oracle sql語句詳細些執行計劃OracleSQL
- Oracle資料庫關於SQL的執行計劃(轉)Oracle資料庫SQL
- 檢視SQL執行計劃的幾種常用方法YQSQL
- 達夢資料庫SQL執行計劃檢視方法資料庫SQL
- 【TUNE_ORACLE】定製化執行計劃SQL參考OracleSQL
- 在MySQL中使用explain查詢SQL的執行計劃MySqlAI
- Oracle檢視sql_id 的歷史執行計劃OracleSQL
- MySQL執行計劃MySql
- SYBASE執行計劃
- MySQL 執行計劃MySql
- 如何閱讀PG資料庫的執行計劃資料庫
- MySQL調優篇 | EXPLAIN執行計劃解讀(4)MySqlAI
- 【執行計劃】Oracle獲取執行計劃的幾種方法Oracle
- Oracle DB 相關常用sql彙總7【手工繫結sql執行計劃】OracleSQL
- 檢視一個正在執行的sql的執行計劃(explain for connection processlist_id)SQLAI
- Oracle優化案例-從執行計劃定位SQL問題(三)Oracle優化SQL