Temp files on Commit

Started by Nicholson, Brad (Toronto, ON, CA)over 12 years ago7 messagesgeneral
Jump to latest

Hi,

I'm seeing cases where I have temp files being written on commit, such as.

2013-08-16 12:09:02 GMT [14480]: [588-1] user=dbuser,db=dbname STATEMENT: COMMIT
2013-08-16 12:09:02 GMT [14480]: [589-1] user= dbuser,db=dbname LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp14480.263", size 814822

Is this a case of having work_mem set to low, or something else? I haven't seen temp files on commit before.

Thanks,
Brad.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Nicholson, Brad (Toronto, ON, CA) (#1)
Re: Temp files on Commit

"Nicholson, Brad (Toronto, ON, CA)" <bnicholson@hp.com> writes:

I'm seeing cases where I have temp files being written on commit, such as.

2013-08-16 12:09:02 GMT [14480]: [588-1] user=dbuser,db=dbname STATEMENT: COMMIT
2013-08-16 12:09:02 GMT [14480]: [589-1] user= dbuser,db=dbname LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp14480.263", size 814822

Is this a case of having work_mem set to low, or something else? I haven't seen temp files on commit before.

They're not being written on commit, they're being cleaned up. That
message about tempfile usage isn't written until the file is deleted,
since we don't know its maximum size for sure until then.

There is some setting that controls whether such messages appear at
all, but I'm too lazy to go look it up right now.

regards, tom lane

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

#3bricklen
bricklen@gmail.com
In reply to: Tom Lane (#2)
Re: Temp files on Commit

On Thu, Aug 22, 2013 at 8:40 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

There is some setting that controls whether such messages appear at
all

Is it "log_temp_files"?

#4Michael Paquier
michael@paquier.xyz
In reply to: bricklen (#3)
Re: Temp files on Commit

On Fri, Aug 23, 2013 at 12:44 AM, bricklen <bricklen@gmail.com> wrote:

On Thu, Aug 22, 2013 at 8:40 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

There is some setting that controls whether such messages appear at
all

Is it "log_temp_files"?

Exactly. More reference here:
http://www.postgresql.org/docs/devel/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT
--
Michael

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

#5Hall, Samuel L (Sam)
sam.hall@alcatel-lucent.com
In reply to: Michael Paquier (#4)
Update quey

I have a table (pubacc_lo) from the US government with 500,00+ rows. It has latitude and longitude in three columns each for degrees, minutes and seconds. I need a Point geometry column. So I wrote this query:

with mydata AS (SELECT (pubacc_lo.lat_degrees + pubacc_lo.lat_minutes/60 + pubacc_lo.lat_seconds/3600) as lat , (pubacc_lo.long_degrees + pubacc_lo.long_minutes/60 + pubacc_lo.long_seconds/3600) as long FROM pubacc_lo)
UPDATE pubacc_lo SET lonlat_84 = ST_SetSRID(ST_makePOINT(long,lat),4326) FROM mydata;

It appears to work, but is going to take days it seems to finish. Anybody have a faster way?

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

#6bricklen
bricklen@gmail.com
In reply to: Hall, Samuel L (Sam) (#5)
Re: Update quey

On Fri, Aug 23, 2013 at 8:04 AM, Hall, Samuel L (Sam) <
sam.hall@alcatel-lucent.com> wrote:

I have a table (pubacc_lo) from the US government with 500,00+ rows. It
has latitude and longitude in three columns each for degrees, minutes and
seconds. I need a Point geometry column. So I wrote this query:

with mydata AS (SELECT (pubacc_lo.lat_degrees + pubacc_lo.lat_minutes/60 +
pubacc_lo.lat_seconds/3600) as lat , (pubacc_lo.long_degrees +
pubacc_lo.long_minutes/60 + pubacc_lo.long_seconds/3600) as long FROM
pubacc_lo)
UPDATE pubacc_lo SET lonlat_84 = ST_SetSRID(ST_makePOINT(long,lat),4326)
FROM mydata;

It appears to work, but is going to take days it seems to finish. Anybody
have a faster way?

Create a new table, rather than updating the existing one.

CREATE TABLE pubacc_lo_new AS
select *, (pubacc_lo.lat_degrees + pubacc_lo.lat_minutes/60 +
pubacc_lo.lat_seconds/3600) as lat , (pubacc_lo.long_degrees +
pubacc_lo.long_minutes/60 + pubacc_lo.long_seconds/3600) as long
from pubacc_lo;

Then either rename them, or use the new table.

#7Hall, Samuel L (Sam)
sam.hall@alcatel-lucent.com
In reply to: bricklen (#6)
Re: Update quey

Thank you! That worked fine.

From: bricklen [mailto:bricklen@gmail.com]
Sent: Friday, August 23, 2013 10:08 AM
To: Hall, Samuel L (Sam)
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Update quey

On Fri, Aug 23, 2013 at 8:04 AM, Hall, Samuel L (Sam) <sam.hall@alcatel-lucent.com<mailto:sam.hall@alcatel-lucent.com>> wrote:
I have a table (pubacc_lo) from the US government with 500,00+ rows. It has latitude and longitude in three columns each for degrees, minutes and seconds. I need a Point geometry column. So I wrote this query:

with mydata AS (SELECT (pubacc_lo.lat_degrees + pubacc_lo.lat_minutes/60 + pubacc_lo.lat_seconds/3600) as lat , (pubacc_lo.long_degrees + pubacc_lo.long_minutes/60 + pubacc_lo.long_seconds/3600) as long FROM pubacc_lo)
UPDATE pubacc_lo SET lonlat_84 = ST_SetSRID(ST_makePOINT(long,lat),4326) FROM mydata;

It appears to work, but is going to take days it seems to finish. Anybody have a faster way?

Create a new table, rather than updating the existing one.
CREATE TABLE pubacc_lo_new AS
select *, (pubacc_lo.lat_degrees + pubacc_lo.lat_minutes/60 + pubacc_lo.lat_seconds/3600) as lat , (pubacc_lo.long_degrees + pubacc_lo.long_minutes/60 + pubacc_lo.long_seconds/3600) as long
from pubacc_lo;
Then either rename them, or use the new table.