Re: Query out of memory

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: aditya desai <admad123(at)gmail(dot)com>
Cc: Vijaykumar Jain <vijaykumarjain(dot)github(at)gmail(dot)com>, pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: Query out of memory
Date: 2021-10-18 21:05:35
Message-ID: CAECtzeUGEBNxpqazBjGkoLGqBMowjTbqdmAan+2ZLOfFtvT01A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance pgsql-sql

Le lun. 18 oct. 2021 à 21:03, aditya desai <admad123(at)gmail(dot)com> a écrit :

> Not many active connections. Only 30-40.
>

This means you can consume up to 60-80 GB. Way much more than the available
RAM. You should lower your work_mem value.

On Monday, October 18, 2021, Vijaykumar Jain <
> vijaykumarjain(dot)github(at)gmail(dot)com> wrote:
>
>> Work memory 2 GB ?
>> Is this intentional?
>> How many max active connections do you see?
>>
>> if you have too many connections. You can try toning it down to
>> https://pgtune.leopard.in.ua/ to start with.
>>
>>
>> On Mon, Oct 18, 2021, 10:13 PM aditya desai <admad123(at)gmail(dot)com> wrote:
>>
>>> Hi,
>>> I am running the below query. Table has 21 million records. I get an Out
>>> Of Memory error after a while.(from both pgadmin and psql). Can someone
>>> review DB parameters given below.
>>>
>>> select t.*,g.column,a.column from
>>> gk_staging g, transaction t,account a
>>> where
>>> g.accountcodeis not null AND
>>> g.accountcode::text <> '' AND
>>> length(g.accountcode)=13 AND
>>> g.closeid::text=t.transactionid::text AND
>>> subsrting(g.accountcode::text,8)=a.mask_code::text
>>>
>>> Below are system parameters.
>>> shared_buffers=3GB
>>> work_mem=2GB
>>> effective_cache_size=10GB
>>> maintenance_work_mem=1GB
>>> max_connections=250
>>>
>>> I am unable to paste explain plan here due to security concerns.
>>>
>>> Regards,
>>> Aditya.
>>>
>>>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message aditya desai 2021-10-19 04:07:48 Re: Query out of memory
Previous Message aditya desai 2021-10-18 19:03:27 Re: Query out of memory

Browse pgsql-sql by date

  From Date Subject
Next Message aditya desai 2021-10-19 04:07:48 Re: Query out of memory
Previous Message aditya desai 2021-10-18 19:03:27 Re: Query out of memory