index in the current database, showing statistics about accesses to that specific index. The pg_stat_user_indexes and pg_stat_sys_indexes views contain the same information, but filtered to only show user and system indexes respectively. pg_stat_all_indexes
• schemaname:schema name • relname:table name • indexrelname:index name • idx_scan:index scan 的次數 • idx_tup_read:通過掃描 index 讀取 index 的數目 • idx_tup_fetch:通過掃描 index 讀取 index 的 fetch 整個 row (live) 的數目 圖 pg_stat_all_indexes columns
存放在 page or block,每一個 page 為 8kb,裡面存放很 多 tuple,每一個 tuple 就代表一個 row 的資料,並給予一個 id 為 TID,其 format 為 (block number, tuple index within the block),代 表真正的所在位置 − (22,8) 資料位於 block 22 的第 8 個 element •index 內存放著 TID 因此可以快速的找到需要的資料
Index 並不會指向原先以外的 block,新舊版本都會存在同一個 block 好處: • 可以即使有更新資料,index 可以保持不變,透過 HOT link 找到正確 version • 把中間 dead tuple 重新整理,不需要使用 vacuum 避免在經常更新的 column 設置 index - HOT update
Index 並不會指向原先以外的 block,新舊版本都會存在同一個 block 好處: • 可以即使有更新資料,index 可以保持不變,透過 HOT link 找到正確 version • 把中間 dead tuple 重新整理,不需要使用 vacuum 滿足條件: • page 或 block 足夠的空間容納新版本 data • 更新的 column value 並不屬於任何一個 index 避免在經常更新的 column 設置 index - HOT update