From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Torsten Förtsch <torsten(dot)foertsch(at)gmx(dot)net> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to make PG use work_mem? |
Date: | 2014-03-11 13:36:04 |
Message-ID: | 10972.1394544964@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
=?ISO-8859-1?Q?Torsten_F=F6rtsch?= <torsten(dot)foertsch(at)gmx(dot)net> writes:
> I have a query that involves an external sort:
> -> Sort (cost=13662680.01..13850498.48 rows=75127389 width=16)
> (actual time=980098.397..1021411.862 rows=74181544 loops=1)
> Sort Key: (ROW(account_id, (purchase_time)::date))
> Sort Method: external merge Disk: 3118088kB
> Buffers: shared hit=1568637 read=1327223,
> temp read=389763 written=389763
> What puzzles me is that this happens even when I set work_mem to 50GB in
> the session.
> Why does it still use the external merge?
Seems odd. I wouldn't have been surprised if you'd said it didn't do it
at work_mem = 5GB. The internal memory requirement can be noticeably
larger than the space required on-disk, mainly because we go to some
lengths to minimize the size of sort tuples when writing them out, but
not if they stay in memory. But a difference of more than maybe 2X to
3X from that effect would be surprising.
Perhaps you fat-fingered the SET somehow?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | nill | 2014-03-11 14:13:01 | Re: Extracting data from the view to retrieve the foreign key is not declared |
Previous Message | Igor Neyman | 2014-03-11 13:20:19 | Re: Increase in max_connections |