Thread: temporary file

temporary file

From
Artem Tomyuk
Date:
Hi.

The questions is how to avoid creating temp files on disk?

The work_mem parameter set to 1600 Megabytes, but on logs i still can see the messages like:
LOG:  temporary file: path "base/pgsql_tmp/pgsql_tmp7905.2", size 865869824

Thanks

Re: temporary file

From
Albe Laurenz
Date:
Artem Tomyuk wrote:
> The questions is how to avoid creating temp files on disk?
> 
> The work_mem parameter set to 1600 Megabytes, but on logs i still can see the messages like:
> LOG:  temporary file: path "base/pgsql_tmp/pgsql_tmp7905.2", size 865869824

Temporary files on disk are smaller than the memory required for the corresponding in-memory
operation, which explains why the size of the temporary file is less than 1600 MB.

You can either try to increase work_mem or change the query so that it does not perform
such large operations.

Yours,
Laurenz Albe

Re: temporary file

From
Keith Fiske
Date:


On Fri, Oct 9, 2015 at 8:53 AM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
Artem Tomyuk wrote:
> The questions is how to avoid creating temp files on disk?
>
> The work_mem parameter set to 1600 Megabytes, but on logs i still can see the messages like:
> LOG:  temporary file: path "base/pgsql_tmp/pgsql_tmp7905.2", size 865869824

Temporary files on disk are smaller than the memory required for the corresponding in-memory
operation, which explains why the size of the temporary file is less than 1600 MB.

You can either try to increase work_mem or change the query so that it does not perform
such large operations.

Yours,
Laurenz Albe

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Probably better off trying to optimize your query vs large work_mem values like that. 
Recommend reading over https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server to learn what work_mem actually does (and a bunch of other great tuning info). You could run yourself out of memory really fast if that's your default work_mem setting. 

--
Keith Fiske
Database Administrator
OmniTI Computer Consulting, Inc.
http://www.keithf4.com