讀這article我發現下面的例子:獲取有關外部排序的一些細節在PostgreSQL中
EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM foo ORDER BY c1;
查詢的計劃是這樣的:
Sort (cost=172682.84..175182.84 rows=1000000 width=37) (actual time=584.215..681.531 rows=1000000 loops=1)
Sort Key: c1
Sort Method: external sort Disk: 45928kB
Buffers: shared hit=3197 read=5137, temp read=5741 written=5741
-> Seq Scan on foo (cost=0.00..18334.00 rows=1000000 width=37) (actual time=0.036..91.914 rows=1000000 loops=1)
Buffers: shared hit=3197 read=5137
Total runtime: 711.195 ms
As known,外部排序是算法家族。這是否意味着PostgreSQL
確實external merge sort
?如果是這樣,我怎樣才能得到一些細節,例如批次數量和大小。它甚至有可能嗎?
你需要尋找到的源代碼。 –
@a_horse_with_no_name這是唯一的方法嗎? PosgtrSQL沒有提供它使用的算法的詳細信息,是嗎? –
它不能得到比實際實現更詳細的內容。 –