Re: Yikes: ERROR: out of memory - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Yikes: ERROR: out of memory
Date
Msg-id D960CB61B694CF459DCFB4B0128514C2039381FA@exadv11.host.magwien.gv.at
Whole thread Raw
In response to Yikes: ERROR: out of memory  ("Carlo Stonebanks" <stonec.register@sympatico.ca>)
List 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

pgsql-general by date:

Previous
From: Dave Page
Date:
Subject: Re: Installing Postgresql on Windows XP embedded
Next
From: itishree sukla
Date:
Subject: Faicng problem while creating system DSN