Re: Query out of memory

From: aditya desai <admad123(at)gmail(dot)com>
To: Geri Wright <geri(dot)w123(at)gmail(dot)com>, pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: Query out of memory
Date: 2021-10-19 04:07:48
Message-ID: CAN0SRDEV9+6Pee-ZqjkSFPU9NsHDSwVRCoQW+=XiCpXtLCKLqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance pgsql-sql

This is how I received a query from the App Team. They have migrated from
Oracle to Postgres. I see in Oracle where it is working fine and also has
the same joins. Some of the developers increased the work_mem. I will try
and tone it down. Will get back to you. Thanks.

On Tue, Oct 19, 2021 at 1:28 AM Geri Wright <geri(dot)w123(at)gmail(dot)com> wrote:

> Hi,
> It looks like you have Cartesian joins in the query. Try updating your
> where clause to include
>
> And g.columnname = t.columnname
> And t.columnname2 = a.columnname2
>
> On Mon, Oct 18, 2021, 12:43 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 05:58:46 Fwd: Query out of memory
Previous Message Guillaume Lelarge 2021-10-18 21:05:35 Re: Query out of memory

Browse pgsql-sql by date

  From Date Subject
Next Message aditya desai 2021-10-19 05:58:46 Fwd: Query out of memory
Previous Message Guillaume Lelarge 2021-10-18 21:05:35 Re: Query out of memory