From: | Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Sort Method: external merge |
Date: | 2011-08-25 07:56:20 |
Message-ID: | CAM6mieLkzt_sGh9eHQOfz-aQObdO4WuhKHnYHPOBC_LeU105nA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I have several queries in *single* transaction and I want to figure
out reasonable work_mem value. Here is the excerpt from "explain plan"
-- each query has two sorts:
1) Sort Method: quicksort Memory: 6 324kB
Sort Method: quicksort Memory: 1 932 134kB
2) Sort Method: quicksort Memory: 28 806kB
Sort Method: quicksort Memory: 977 183kB
3) Sort Method: quicksort Memory: 103 397kB
Sort Method: external merge Disk: 3 105 728kB
4) Sort Method: quicksort Memory: 12 760kB
Sort Method: quicksort Memory: 3 704 460kB
5) Sort Method: quicksort Memory: 84 862kB
Sort Method: external merge Disk: 3 593 120kB
6) Sort Method: quicksort Memory: 4 828kB
Sort Method: quicksort Memory: 112 472kB
7) Sort Method: quicksort Memory: 1 490kB
Sort Method: quicksort Memory: 81 066kB
8) Sort Method: quicksort Memory: 78174kB
Sort Method: quicksort Memory: 2 579 739kB
9) Sort Method: quicksort Memory: 101 717kB
Sort Method: quicksort Memory: 2 913 709kB
work_mem is set to 4 000 000 kb and I do not understand why few
queries (3 and 5) used disk and the rest fit were able to data into
memory. Why disk was used and subsequent query was able to sort bigger
data set in the memory (see 3 and 4)? The box has 90GB RAM and no
other queries run during that time.
PG version is: PostgreSQL 8.4.7 on x86_64-redhat-linux-gnu, compiled
by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50), 64-bit
Thanks,
--
Ondrej Ivanic
(ondrej(dot)ivanic(at)gmail(dot)com)
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Barnes | 2011-08-25 08:57:22 | |
Previous Message | tuanhoanganh | 2011-08-25 06:57:45 | Re: Links to Replication |