Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nOtQz-0005RF-V4 for pgsql-performance@arkaria.postgresql.org; Tue, 01 Mar 2022 03:44:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nOtQy-0004e8-Gm for pgsql-performance@arkaria.postgresql.org; Tue, 01 Mar 2022 03:44:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nOtQy-0004dx-0S for pgsql-performance@lists.postgresql.org; Tue, 01 Mar 2022 03:44:20 +0000 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nOtQr-0000vY-IT for pgsql-performance@lists.postgresql.org; Tue, 01 Mar 2022 03:44:19 +0000 Received: by mail-qk1-x731.google.com with SMTP id 185so12091461qkh.1 for ; Mon, 28 Feb 2022 19:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to; bh=rVCdFqLSmKUu9lCNhpVR71B/rvhjKJOX5YrCNQWudG8=; b=mNKfecJdv/nD/K9SkN76PfP6OH3LjU/wohTmlKI0iiH4mR8GIJZ7Q27zMeTl1saP0c dV0QZ20Xsq1WUc9FhxAEbU9iV95ZjEtl7lsKjMLau4AXqeZOMkIpIVqI85dW5hZSnh+M lHGY8x+Ng+EG35gPt3YesdvCQxslPLNrjk5cnp6vi1aKOhc33dPPbEUE0SmH/+qt/7Oz 8aM3Bd8iUy8tdph5Wu8iXWtJExvnie8lWPB53AcweDV9JcmE0NpPWtW7GU5F4idv9yTn Ob0DPkzUdNY2jBvk3BHAaxt4mpOT1lgh9JVd1R4qx/nCOScHwDo2HbXpPekaJwOzh3LK vP1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=rVCdFqLSmKUu9lCNhpVR71B/rvhjKJOX5YrCNQWudG8=; b=57vvLfZTa2uf9rlIk92mm6IVb0zVBEBOQLGxmZthuxWekUGHdBVvmYzNAaFyD91qu/ wp09N2mP/vzuRrCeWp2tiPRnEl1++vr/Cae0qeHvENPllT47kmpaJYDzzPgcUu2MMv1Q OoQ8QUWVo8rb6p3fUVsOCQkyISrVWOWwHFANWEzXD7KdlaH4YJv6sEIAxVJwz0Vg62HY fTLm3oQIHHftpAUECSjl/ixQl24mEgM6/15DDFQ38Ocm8GZNlId1iqHOXntM2D7S6xNx 9BSBRtyJwyc9X8pz3Lzf7myoFvjG+K+MUz9G17j4G1b2tpJIQxePDJZF9VUUGXQ66At7 beAQ== X-Gm-Message-State: AOAM530Dcudqbu7a8IpiYnrxHCUonUmAPufeAASnW+9sBboXbNhA4RpG 0wWCRFzaiL3b2BhqlvM06Qohewyy4Yg= X-Google-Smtp-Source: ABdhPJzI5v+b6TaCUPiN3aq/TUAcmDquKKOOtj2OY7ds5T7haAToGNR1FIS6KjL/MQqWviQ233b0aA== X-Received: by 2002:a05:620a:31a6:b0:646:d4d6:793a with SMTP id bi38-20020a05620a31a600b00646d4d6793amr13002540qkb.718.1646106250739; Mon, 28 Feb 2022 19:44:10 -0800 (PST) Received: from [192.168.2.100] (pool-72-79-19-93.nwrknj.east.verizon.net. [72.79.19.93]) by smtp.gmail.com with ESMTPSA id b137-20020ae9eb8f000000b00648f9736ab0sm6020859qkg.124.2022.02.28.19.44.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Feb 2022 19:44:09 -0800 (PST) Content-Type: multipart/alternative; boundary="------------H6GYn5vDO5rFjr5LxrCd0Bll" Message-ID: <242bb192-e280-42bb-b6a2-30e6d5466472@gmail.com> Date: Mon, 28 Feb 2022 22:44:09 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: Never Ending query in PostgreSQL Content-Language: en-US To: pgsql-performance@lists.postgresql.org References: From: Mladen Gogala In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------H6GYn5vDO5rFjr5LxrCd0Bll Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/26/22 23:40, Kumar, Mukesh wrote: > Hi Team, > > Can you please help in tunning the attached query as , i am trying to > run this query and it runs for several hours and it did not give any > output. > > I am not able to generate the explain analyze plan as well and it > keeps on running for several hours and did not give output. > > I have attached the query and explain plan without analyze. Please > help if nayone has any idea how to tune that query. > > Regards, > Mukesh Kumar Hi Team Member, Your attachments are not SQL, they are plans. Judging by the size of the plans, your best course of action is to completely rewrite the queries, probably using CTE and temporary tables. May the Force be with you. Regards -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com --------------H6GYn5vDO5rFjr5LxrCd0Bll Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 2/26/22 23:40, Kumar, Mukesh wrote:
Hi Team, 

Can you please help in tunning the attached query as , i am trying to run this query and it runs for several hours and it did not give any output.

I am not able to generate the explain analyze plan as well and it keeps on running for several hours and did not give output.

I have attached the query and explain plan without analyze. Please help if nayone has any idea how to tune that query.

Regards, 
Mukesh Kumar 


Hi Team Member,

Your attachments are not SQL, they are plans. Judging by the size of the plans, your best course of action is to completely rewrite the queries, probably using CTE and temporary tables. May the Force be with you.

Regards

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
--------------H6GYn5vDO5rFjr5LxrCd0Bll--