How to make PG use work_mem? - Mailing list pgsql-general

From Torsten Förtsch
Subject How to make PG use work_mem?
Date
Msg-id 531EFE76.5080501@gmx.net
Whole thread Raw
Responses Re: How to make PG use work_mem?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-general by date:

Previous
From: Albe Laurenz
Date:
Subject: Re: Extracting data from the view to retrieve the foreign key is not declared
Next
From: "Aggarwal, Ajay"
Date:
Subject: Re: replication timeout in pg_basebackup