Tom Lane wrote:
> It'd clearly be worth our while to mention boosting sort_mem as a
> helpful thing to do during bulk data load --- it should speed up
> btree index creation too. I don't think that tip appears anywhere
> in the docs at the moment.
Added recently, see last sentence:
<term><varname>sort_mem</varname> (<type>integer</type>)</term> <listitem> <para> Specifies the
amountof memory to be used by internal sort operations and hash tables before switching to temporary disk files.
Thevalue is specified in kilobytes, and defaults to 1024 kilobytes (1 MB). Note that for a complex query,
severalsort or hash operations might be running in parallel; each one will be allowed to use as much memory
asthis value specifies before it starts to put data into temporary files. Also, several running sessions could be
doing sort operations simultaneously. So the total memory used could be many times the value of
<varname>sort_mem</varname>.Sort operations are used by <literal>ORDER BY</>, merge joins, and <command>CREATE
INDEX</>. Hash tables are used in hash joins, hash-based aggregation, and hash-based processing of
<literal>IN</>subqueries. Because <command>CREATE INDEX</> is used when restoring a database, it might be
goodto temporarily increase this value during a restore. </para>
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square,
Pennsylvania19073