Re: Yikes: ERROR: out of memory

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Carlo Stonebanks *EXTERN*" <stonec(dot)register(at)sympatico(dot)ca>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Yikes: ERROR: out of memory
Date: 2010-03-15 08:42:07
Message-ID: D960CB61B694CF459DCFB4B0128514C2039381FA@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Carlo Stonebanks wrote:
> Now THIS is a new one for me! I have no idea where to even start. Does
> anyone know how to look for the error? Below is the query and what I believe
> are the related log entries.
>
[...]
>
> SELECT facility_id, street_address, base_zip, COUNT(*) AS
> provider_count
> FROM (
> SELECT DISTINCT
> f.facility_id,
> p.provider_id,
> TRIM(COALESCE(a.parsed_number, '')||' '||a.parsed_street) AS
> street_address,
> SUBSTR(a.postal_code, 1, 5) AS base_zip
> FROM mdx_core.provider AS p
> JOIN mdx_core.provider_practice AS pp USING (provider_id)
> JOIN mdx_core.facility_address AS fa USING (facility_address_id)
> JOIN mdx_core.facility AS f ON f.facility_id = fa.facility_id
> JOIN mdx_core.address AS a USING (address_id)
> WHERE
> p.provider_status_code = 'A'
> AND pp.practice_tier_code <= '3'
> ) AS p_per_addr
> GROUP BY facility_id, street_address, base_zip
> HAVING COUNT(*) > 1
>
> ERROR: out of memory
> DETAIL: Failed on request of size 134217728.

[...]

What is your work_mem setting?

At first glance it looks as if you have dangerously little free memory
and a high work_mem setting (and possibly many connections doing expensive
operation concurrently). Are you aware that work_mem limits memory use
per operation, so you need to have more than work_mem * max_connections
memory free to be on the safe side?

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message itishree sukla 2010-03-15 08:43:27 Faicng problem while creating system DSN
Previous Message Dave Page 2010-03-15 08:23:14 Re: Installing Postgresql on Windows XP embedded