From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | psuderevsky(at)gmail(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #14078: Excessive memory growth during nested loop in select |
Date: | 2016-04-12 21:15:39 |
Message-ID: | 5559.1460495739@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
psuderevsky(at)gmail(dot)com writes:
> [ query producing a 46-million-row join result ]
> Observing amount of memory consumed by psql process with pmap utility...
> So about 8Gb of linux virtual memory has been allocated for join of two
> tables with sizes of 11MB.
> The question is why so high amount of virtual memory is consumed, isn't it
> a memory leak.
No, it's just a very large query result. psql collects the entire query
result into memory before printing any of it, so that it can format the
result nicely. If you're dealing with query results large enough for that
to be a problem, you could consider using psql's FETCH_COUNT variable to
make it fetch and format a smaller number of rows at a time; which would
trade off the niceness of the formatting for less memory usage.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Berg | 2016-04-13 09:41:17 | Bus error in pg_logical_slot_get_changes (9.4.7, sparc) |
Previous Message | Magnus Hagander | 2016-04-12 15:18:32 | Repeated requests for feedback in logical standby |