Re: [GENERAL] Sort Method: external merge

2011-08-25 Thread Ondrej Ivanič
Hi, On 26 August 2011 00:14, Tom Lane wrote: > =?UTF-8?Q?Ondrej_Ivani=C4=8D?= writes: >> 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. > > The on-disk representation of sort data is quite a bit mo

Re: [GENERAL] Sort Method: external merge

2011-08-25 Thread Tom Lane
=?UTF-8?Q?Ondrej_Ivani=C4=8D?= writes: > 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. The on-disk representation of sort data is quite a bit more compact than the in-memory representation. So where

[GENERAL] Sort Method: external merge

2011-08-25 Thread Ondrej Ivanič
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 13

Re: [GENERAL] Sort method: external merge

2009-02-04 Thread Jeff Davis
On Wed, 2009-02-04 at 02:15 -0800, wstrzalka wrote: > Isn't it possible to sort only fields that order matters & some row > identifier/position (don't really know what - oid/ctid are tight to > table but something temporary tight to 'resultset')? It would take > much less memory and could be proces

[GENERAL] Sort method: external merge

2009-02-04 Thread wstrzalka
It's kind of lame questions, possibly I'm missing something but my doubts are as follow: When planner/executor needs to sort rowsit sorts whole records (i think so). So in the case when there are many wide columns it takes quite a lot of memory and sort goes out to the disk because it excess the w