Re: Sort Method: external merge

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sort Method: external merge
Date: 2011-08-25 14:14:05
Message-ID: 1309.1314281645@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?UTF-8?Q?Ondrej_Ivani=C4=8D?= <ondrej(dot)ivanic(at)gmail(dot)com> 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 it says that 3.5GB of disk were
needed, it's not a surprise that the memory requirement would have
exceeded 4GB to do the sort in-memory.

If you want to know what the conversion factor is for your particular
dataset, try doing the query with small and large work_mem so you can
see what is reported as the amount of space needed each way.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message uanacho 2011-08-25 15:35:33 rollback doubt and connection to remoteDB
Previous Message Samba 2011-08-25 13:29:14 Re: Streaming Replication: Observations, Questions and Comments