How to make PG use work_mem?

From: Torsten Förtsch <torsten(dot)foertsch(at)gmx(dot)net>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: How to make PG use work_mem?
Date: 2014-03-11 12:15:50
Message-ID: 531EFE76.5080501@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

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?

The query runs on a streaming replica if that matters.

Torsten

Responses

Browse pgsql-general by date

  From Date Subject
Next Message matshyeq 2014-03-11 12:39:12 Re: libpq - lack of support to set the fetch size
Previous Message Albe Laurenz 2014-03-11 08:08:53 Re: Extracting data from the view to retrieve the foreign key is not declared