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 1kf6WL-0006Nx-0X for pgsql-admin@arkaria.postgresql.org; Tue, 17 Nov 2020 19:20:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kf6WJ-0004ng-Uh for pgsql-admin@arkaria.postgresql.org; Tue, 17 Nov 2020 19:20:03 +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 1kf6WJ-0004nZ-HA for pgsql-admin@lists.postgresql.org; Tue, 17 Nov 2020 19:20:03 +0000 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kf6W9-0000WU-S0 for pgsql-admin@lists.postgresql.org; Tue, 17 Nov 2020 19:20:02 +0000 Received: by mail-ot1-x330.google.com with SMTP id n89so20541474otn.3 for ; Tue, 17 Nov 2020 11:19:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=wB/hYRy7loiv2tJ6AG67xNqz5W0eE8jI8kjH5Aomiio=; b=MGu5Wt+vVWaz2P2x7Ff5DKoppth3LfIJV+eIXk7jTrn58g5kCL+UelqPepTe+xGsxS tr8Z2urhgvtS5EH8O0UCuF1S9532TghSZ4Mc8zJd7tgawTyOaup+wtvE/qSilzqBYClx tzn6cGPyT2qOKPnBeyglVhjPI54LC9sxX0tTsJHPLLTe/tbxymUT2liA4RhXovNvyQ4Q DYr4KzDIYOiLz1ecrQB8uzg1iH4GXR+TGhgE4ShcpZi34fp4JhU92yYs9mGcdm+15Ycg GiuYtbCdDcY5wkumy6AIwBllKzMjRMSR/AxvWZGoPiXQG5y6HU/zdGSPGnMHZS9la/Ji Lb0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=wB/hYRy7loiv2tJ6AG67xNqz5W0eE8jI8kjH5Aomiio=; b=ssY8G+blGlgtUdkNCZa9956X6uUb1k+oxAjel9oYhbqDFUGCGPNS8/jdE57K2p9khx fAh7XFDFyjD6qRu0xW9KVKMUJO93MPy3cxI82xo7MxhWe0q3Olb6mRu41f4iecPdmfEE WJ9eGYGbnfBtmaayAwmHWw7S+9oFBkFocPzbtYXZ/TD3eDJsOGLzglOR/xnnWAdXivO0 8LfvggZumoxSgHBZd5NXSOxXD0Fj/LaMPz7eIReoIhPdQ3TWR4syADp7f0XIm2Lvkm+0 ZwLAIBHnpI2H0hGuZxtYyZpYtDJMUbhbgKRn/RoWvbzVzkQ/nt0CDR7w8b0Wl/USpS30 89qA== X-Gm-Message-State: AOAM5339K4Zn7c7/gfM2nXMqPSC36wbMUeRjbIISP5yLj1sy9PCPneA7 dClDU5R3AtlHfHo2uBPcl2Jgun7oPaiu1g== X-Google-Smtp-Source: ABdhPJzeOxhn0RGOjp67QKvhhk8s1qWfiNSrJlScjtL3g7P7Q4szHp/WwXKTVeogV5/+OrLOOMmQ8Q== X-Received: by 2002:a9d:7695:: with SMTP id j21mr3947643otl.294.1605640792798; Tue, 17 Nov 2020 11:19:52 -0800 (PST) Received: from [192.168.1.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id x9sm5342724otk.9.2020.11.17.11.19.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Nov 2020 11:19:51 -0800 (PST) Subject: Re: PostgreSQL Tuning and running a query on a big data To: pgsql-admin@lists.postgresql.org References: <165cda9c-07f3-0243-5378-5d520a8826f8@gmail.com> From: Ron Message-ID: <994aaff7-43c3-4c4c-0628-b133ddc6eee8@gmail.com> Date: Tue, 17 Nov 2020 13:19:51 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------4C9C6F35B52FA189037F560B" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------4C9C6F35B52FA189037F560B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 11/17/20 11:58 AM, Sachin Kumar wrote: > Hi Ron, > > Thanks for the revert, > > Indices mean Indexes than yes I am using Indexes for teh table. if it is > something else, can you help me with a simple query of indices which I can > use in my code? What indexes are on those tables? Have you run ANALYZE on the tables? Have you run EXPLAIN on the query? The documentation explains how to use them. > On Tue, Nov 17, 2020 at 11:10 PM Ron > wrote: > > On 11/17/20 11:34 AM, Sachin Kumar wrote: >> Hi Experts, >> >> 1.   I require guidance in tuning my PostgreSQL server installed on >> Windows 2016 Server. Please help me out with the configuration. or >> a url to ture PostgreSQL Server >> >> I am not able to find an expert who can help me in Postgres, that why >> I am asking too many questions. I will be really grateful if you can >> help me out. >> >> >> 2.   I have to upload a 5 GB file into a Table. Will it allow a 5GB >> file to be uploaded? or I have to increase the tablespace of the >> particular table. > > Postgres auto-expands files as needed. > >> >> 3.   while running the query on 1 million cards it is taking too much >> time, say 150 min. is there any way I can reduce it. >> *Query I am using* >> UPDATE hk_card_master_test m >> SET "ACCOUNT_NUMBER" = v."v_account_number", "ISSUANCE_NUMBER" = >> v."v_issuance_number","cron"=1 >> FROM ( >> SELECT h."id",h."CARD_SEQUENCE_NUMBER" ,h."ACCOUNT_NUMBER" >> ,h."ISSUANCE_NUMBER",c."ACCOUNT_NUMBER" >> v_account_number,c."ISSUANCE_NUMBER" v_issuance_number >> FROM >> hk_card_master_test h >> JOIN >> vdaccount_card_bank c >> ON SUBSTR(c."ACCOUNT_NUMBER", 1, 10) = h."CARD_SEQUENCE_NUMBER" >> ORDER BY h."id" ASC LIMIT 1000 >> ) AS v >> WHERE m."CARD_SEQUENCE_NUMBER" = v."CARD_SEQUENCE_NUMBER"; > > Did you put indices on m."CARD_SEQUENCE_NUMBER and > SUBSTR(c."ACCOUNT_NUMBER", 1, 10)? > > -- > Angular momentum makes the world go 'round. > > > > -- > > Best Regards, > Sachin Kumar -- Angular momentum makes the world go 'round. --------------4C9C6F35B52FA189037F560B Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

On 11/17/20 11:58 AM, Sachin Kumar wrote:
Hi Ron,

Thanks for the revert,

Indices mean Indexes than yes I am using Indexes for teh table. if it is something else, can you help me with a simple query of indices which I can use in my code?

What indexes are on those tables?
Have you run ANALYZE on the tables?
Have you run EXPLAIN on the query?

The documentation explains how to use them.

On Tue, Nov 17, 2020 at 11:10 PM Ron <ronljohnsonjr@gmail.com> wrote:
On 11/17/20 11:34 AM, Sachin Kumar wrote:
Hi Experts,

1.   I require guidance in tuning my PostgreSQL server installed on Windows 2016 Server. Please help me out with the configuration. or a url to ture PostgreSQL Server

I am not able to find an expert who can help me in Postgres, that why I am asking too many questions. I will be really grateful if you can help me out.


2.   I have to upload a 5 GB file into a Table. Will it allow a 5GB file to be uploaded? or I have to increase the tablespace of the particular table.

Postgres auto-expands files as needed.


3.   while running the query on 1 million cards it is taking too much time, say 150 min. is there any way I can reduce it.
Query I am using
UPDATE hk_card_master_test m
SET "ACCOUNT_NUMBER" = v."v_account_number", "ISSUANCE_NUMBER" = v."v_issuance_number","cron"=1
FROM (
SELECT h."id",h."CARD_SEQUENCE_NUMBER" ,h."ACCOUNT_NUMBER" ,h."ISSUANCE_NUMBER",c."ACCOUNT_NUMBER" v_account_number,c."ISSUANCE_NUMBER" v_issuance_number
FROM
hk_card_master_test h
JOIN
vdaccount_card_bank c
ON SUBSTR(c."ACCOUNT_NUMBER", 1, 10) = h."CARD_SEQUENCE_NUMBER"
ORDER BY h."id" ASC LIMIT 1000
) AS v
WHERE m."CARD_SEQUENCE_NUMBER" = v."CARD_SEQUENCE_NUMBER";

Did you put indices on m."CARD_SEQUENCE_NUMBER and SUBSTR(c."ACCOUNT_NUMBER", 1, 10)?

--
Angular momentum makes the world go 'round.


--

Best Regards,
Sachin Kumar

--
Angular momentum makes the world go 'round.
--------------4C9C6F35B52FA189037F560B--