pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedQuere keep using temporary files
5+ messages / 3 participants
[nested] [flat]
* Quere keep using temporary files
@ 2019-10-25 08:22 rihad <rihad@mail.ru>
0 siblings, 2 replies; 5+ messages in thread
From: rihad @ 2019-10-25 08:22 UTC (permalink / raw)
To: pgsql-general
Hi, we frequently run many query involving XML that use a smallish
temporary file, despite having increased local work_mem in that
transaction to 16GB. FreeBSD's top shows that the memory isn't actually
being used - it remains free. Basically many such queries are run within
a single transaction:
LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp92452.1079", size 166518
STATEMENT: DELETE FROM "foo" WHERE ((col1, col2, col3) in (select col1,
col2, col3 from foo_xml_v2('<here goes xml-formatted blob>'))) AND
"foo"."col_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9)
It looks like increasing work_mem doesn't help. Surely 16GB is enough to
cover all these small temp files?
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Quere keep using temporary files
@ 2019-10-25 11:03 Luca Ferrari <fluca1978@gmail.com>
parent: rihad <rihad@mail.ru>
1 sibling, 0 replies; 5+ messages in thread
From: Luca Ferrari @ 2019-10-25 11:03 UTC (permalink / raw)
To: rihad <rihad@mail.ru>; +Cc: pgsql-general
On Fri, Oct 25, 2019 at 10:23 AM rihad <rihad@mail.ru> wrote:
> LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp92452.1079", size 166518
> STATEMENT: DELETE FROM "foo" WHERE ((col1, col2, col3) in (select col1,
> col2, col3 from foo_xml_v2('<here goes xml-formatted blob>'))) AND
> "foo"."col_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9)
Isn't work_mem used for hashing and sorting, gin and stuff like that?
Luca
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Quere keep using temporary files
@ 2019-10-25 13:49 Tom Lane <tgl@sss.pgh.pa.us>
parent: rihad <rihad@mail.ru>
1 sibling, 1 reply; 5+ messages in thread
From: Tom Lane @ 2019-10-25 13:49 UTC (permalink / raw)
To: rihad <rihad@mail.ru>; +Cc: pgsql-general
rihad <rihad@mail.ru> writes:
> Hi, we frequently run many query involving XML that use a smallish
> temporary file, despite having increased local work_mem in that
> transaction to 16GB. FreeBSD's top shows that the memory isn't actually
> being used - it remains free. Basically many such queries are run within
> a single transaction:
> LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp92452.1079", size 166518
> STATEMENT: DELETE FROM "foo" WHERE ((col1, col2, col3) in (select col1,
> col2, col3 from foo_xml_v2('<here goes xml-formatted blob>'))) AND
> "foo"."col_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9)
> It looks like increasing work_mem doesn't help. Surely 16GB is enough to
> cover all these small temp files?
You'd need to provide a lot more detail about what that query is doing
for anyone to be able to guess where the temp file usage is coming from.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Quere keep using temporary files
@ 2019-10-25 15:56 rihad <rihad@mail.ru>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: rihad @ 2019-10-25 15:56 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general
On 10/25/2019 05:49 PM, Tom Lane wrote:
> rihad <rihad@mail.ru> writes:
>> Hi, we frequently run many query involving XML that use a smallish
>> temporary file, despite having increased local work_mem in that
>> transaction to 16GB. FreeBSD's top shows that the memory isn't actually
>> being used - it remains free. Basically many such queries are run within
>> a single transaction:
>> LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp92452.1079", size 166518
>> STATEMENT: DELETE FROM "foo" WHERE ((col1, col2, col3) in (select col1,
>> col2, col3 from foo_xml_v2('<here goes xml-formatted blob>'))) AND
>> "foo"."col_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9)
>> It looks like increasing work_mem doesn't help. Surely 16GB is enough to
>> cover all these small temp files?
> You'd need to provide a lot more detail about what that query is doing
> for anyone to be able to guess where the temp file usage is coming from.
>
> regards, tom lane
> .
>
I just checked and saw that the function "foo_xml_v2" above returns
table. Is this enough to trigger temporary file usage regardless of
work_mem?
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Quere keep using temporary files
@ 2019-10-25 17:33 Tom Lane <tgl@sss.pgh.pa.us>
parent: rihad <rihad@mail.ru>
0 siblings, 0 replies; 5+ messages in thread
From: Tom Lane @ 2019-10-25 17:33 UTC (permalink / raw)
To: rihad <rihad@mail.ru>; +Cc: pgsql-general
rihad <rihad@mail.ru> writes:
> On 10/25/2019 05:49 PM, Tom Lane wrote:
>> You'd need to provide a lot more detail about what that query is doing
>> for anyone to be able to guess where the temp file usage is coming from.
> I just checked and saw that the function "foo_xml_v2" above returns
> table. Is this enough to trigger temporary file usage regardless of
> work_mem?
No --- that would result in creation of a tuplestore to hold the function
result, but it shouldn't spill to disk until it exceeds work_mem ...
or at least so I'd expect. Can you extract a self-contained case that
creates a small temp file?
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2019-10-25 17:33 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 08:22 Quere keep using temporary files rihad <rihad@mail.ru>
2019-10-25 11:03 ` Luca Ferrari <fluca1978@gmail.com>
2019-10-25 13:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-10-25 15:56 ` rihad <rihad@mail.ru>
2019-10-25 17:33 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox