據我所知,索引并沒有完全加載到記憶體中,這就是導致它變慢的原因?我對么?
obs:出于隱私考慮,我稍微更改了“輸出”部分
-> Index Scan using idx_customers_orders on public.customers (cost=0.57..20.28 rows=1 width=13) (actual time=1.757..1.774 rows=1 loops=46257)
Output: customers.id, customers.created_at, customers.created_by ,customers.registration ,customers.name ,customers.description ,customers.address ,customers.location ,customers.code
Index Cond: (customers.i_order = orders.i_order)
Filter: ((NOT customers.deleted) AND (customers.i_databases = (current_setting('db.tenant'::text))::integer))
Rows Removed by Filter: 0
Buffers: shared hit=164654 read=68033
I/O Timings: read=80791.000
uj5u.com熱心網友回復:
索引掃描很快(平均 1.774 毫秒)。執行速度很慢,因為索引掃描執行了 46257 次。從磁盤讀取一個 8kB 塊的時間略多于 1 毫秒并不是那么糟糕。
最有可能的是,索引掃描位于嵌套回圈連接的內側。也許不同的加入策略會更好;由于您沒有顯示執行計劃,我們無法判斷。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/418796.html
標籤:
