Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcY2p-0006W5-00 for pgsql-admin@arkaria.postgresql.org; Tue, 01 Aug 2017 14:21:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dcY2o-0001jt-3k for pgsql-admin@arkaria.postgresql.org; Tue, 01 Aug 2017 14:21:10 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dcY2n-0001ja-JC; Tue, 01 Aug 2017 14:21:09 +0000 Received: from mail-qk0-x22c.google.com ([2607:f8b0:400d:c09::22c]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dcY2k-0008Dm-Gb; Tue, 01 Aug 2017 14:21:08 +0000 Received: by mail-qk0-x22c.google.com with SMTP id d145so9907129qkc.2; Tue, 01 Aug 2017 07:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=iDX5iJFhZ3ZyUNyQpys+tOddsTtLHzYuKLR8MxZkQRI=; b=Z4KgcNWASshwymtI97ByYEAsuR68xO7ipBYXfxhGaxFbyZ3CqQTFLl7VyLzUPO8Fl5 7LFsYoHA6Tl4jx4zfK3U2O8KpqZUgXfZgFLGrtTb5/dNibsLVVqXx5eJ5fgCWW49zgR0 uFJyRtXpF2FnvZRH7MXuRD2S705DJnfVsz0tnT9yvmjuigZ3nqF+w4qRP8CIjSSbAE4m bD4QYjfARMhlT9kpeTBDk9kNXekIu/jZ88DtEuQLsAFFq5N8bqhIV9CrtAIajH+NO8QJ vY46V/nHzka0EaxNh0uM54Nh92I4aXDsNLhB8NsK+KUXyrcaG6wZXp7BIWgEagmV/Eau OPcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=iDX5iJFhZ3ZyUNyQpys+tOddsTtLHzYuKLR8MxZkQRI=; b=gInx4fL4MNGYupwaTZcO3rPJtGB+7bRgbyjZBi372OKxzZOZ4yHV+5Ef95ztXNnOL8 gJ+Hvyr+LJGok34blVAimATPKRwtDtL5PeXXWSBe8/uugDAnUKtXwlGOYt8uPIxWT11k madiGsCSu9INkOZQwDTLqYmftoH7z+Wa5Z+cWrr1z7igxcVBiqf3Y8DLzVmr+W5bJ7MR CKyz/PFwJ5DFJQJQ5feyMBrwkQOF97YLwg/jW8nyShoBwFYohEoB3udtsllVZaCSIZRI VhicZDWirKE1QVrByZFpBXCgYzeydYo0OqnM/gIuaujZ5RFdGwKz06rSkRxrEBNuZOx9 F4TA== X-Gm-Message-State: AIVw113FLuFyE2/1s5YZzvPMUvYCM+PqQ+fusjuJ80IEG+ph9dFj2Ue8 HDFJqWo8pCTwnvyN X-Received: by 10.55.51.16 with SMTP id z16mr24503122qkz.73.1501597265231; Tue, 01 Aug 2017 07:21:05 -0700 (PDT) Received: from [192.112.10.245] (as5300-s42-216.cnt.entelchile.net. [164.77.140.226]) by smtp.gmail.com with ESMTPSA id 97sm16217215qtg.29.2017.08.01.07.21.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 07:21:04 -0700 (PDT) Subject: Re: [PERFORM] 2 server with same configuration but huge difference in performance To: Keith , Sumeet Shukla Cc: pgsql-admin , pgsql-performance@postgresql.org References: From: Anthony Sotolongo Message-ID: <084c7a84-5035-10b7-80a0-f5c19968c485@gmail.com> Date: Tue, 1 Aug 2017 10:21:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------ACD993CF224ECD1D827D80CD" Content-Language: es-ES List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --------------ACD993CF224ECD1D827D80CD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Sumeet Shukla While script is running check the pg_stat_activity, this view can be util Regards Anthony On 01/08/17 10:16, Keith wrote: > > On Tue, Aug 1, 2017 at 9:41 AM, Sumeet Shukla > > wrote: > > Hi, > > I have 2 PG servers with same h/w and configuration and they are > not in replication. > > On server A it takes 20 minutes to execute the script. > On server B it takes more than 20 hours. (Seems to be stuck with > create index and and create foreign key steps) > > Any guidance to troubleshoot this would be highly appreciated. > > Thanks & Regards, > Sumeet Shukla > > > Check for long running queries on the server that is taking longer. If > it's things like CREATE INDEX or ALTER TABLE statements that are being > blocked, a transaction running on the table involved will cause those > commands to be held until those transactions complete. > > If it's normal read/write queries to that are taking longer, ensure > the database statistics are up to date by running an analyze. > > Keith --------------ACD993CF224ECD1D827D80CD Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

Hi Sumeet Shukla

While script is running check the pg_stat_activity, this view can be util


Regards

Anthony


On 01/08/17 10:16, Keith wrote:

On Tue, Aug 1, 2017 at 9:41 AM, Sumeet Shukla <sumeet.k.shukla@gmail.com> wrote:
Hi,

I have 2 PG servers with same h/w and configuration and they are not in replication.

On server A it takes 20 minutes to execute the script.
On server B it takes more than 20 hours. (Seems to be stuck with create index and and create foreign key steps)

Any guidance to troubleshoot this would be highly appreciated.

Thanks & Regards,
Sumeet Shukla


Check for long running queries on the server that is taking longer. If it's things like CREATE INDEX or ALTER TABLE statements that are being blocked, a transaction running on the table involved will cause those commands to be held until those transactions complete.

If it's normal read/write queries to that are taking longer, ensure the database statistics are up to date by running an analyze.

Keith

--------------ACD993CF224ECD1D827D80CD--