Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcXyd-0006Eq-UX for pgsql-admin@arkaria.postgresql.org; Tue, 01 Aug 2017 14:16:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dcXyd-0003fV-H4 for pgsql-admin@arkaria.postgresql.org; Tue, 01 Aug 2017 14:16:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dcXyd-0003fM-4w for pgsql-admin@postgresql.org; Tue, 01 Aug 2017 14:16:51 +0000 Received: from mail-ua0-x230.google.com ([2607:f8b0:400c:c08::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dcXyY-0006HV-UI for pgsql-admin@postgresql.org; Tue, 01 Aug 2017 14:16:50 +0000 Received: by mail-ua0-x230.google.com with SMTP id f9so7547456uaf.4 for ; Tue, 01 Aug 2017 07:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=keithf4-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4kSyT9fbGw7usrfMd6/vk6/7yB7XQT4JGWqONILN5oE=; b=kPZguGms5B+tIPX23qoZB5QGywQoraTQuDZMDBVfRUMIrEhG66nyOFuNr4U0bPiVQr FG3g1rjz+oMWTMl8XVTzSuTJces4TvA2dM/XZTr1CY2brildFILHf/MPIwoYlHUzTF5a 0pPibHe3s6hSQgoHEU55FCzXbQmPgMtZiXobY8zXgQssYujV+2YNTxM5u+t72Y0skc/3 CFZs3WbQAKhk9GB18AGCyEHXFRVr4jnwuQ2SgRfRdxiUtj3fXq8+ZUsuV3sYX1wmIWJG Q79NdwGqEcXkAPYHVd3f7cTUfeAokqQR9JrvSgp+oh8Yfz5gCfjgj169Ypic9uI5jy5J 1qrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4kSyT9fbGw7usrfMd6/vk6/7yB7XQT4JGWqONILN5oE=; b=aNMiSUqJdbOV+bejfkA9r6LWtKDmq1430t/ys6ds3wKCyYG2YG/So3qOeK3pshN06r XUhFDKYLlg8n8f7S6zWQJgLQqymGaJpMe/hLNVo983+nYDfqmkhkJ/k48G0r+gEZx3it cRTJkE7XrhG4mcewOdWcihm8TrXnceJyysuzfucQNgE7EpNhsxHkWPdREJT22o1I+yKS 1k9BGbEH3/8y6Y5ITNfU9A4oEElNAb4y7u63dE1O3y6S4p+R4n1QSmTxcj/l4YjeUymq x5qxpcFpFLlgD3YXvPJOR8IOG4Lt/UxAws9gmTqVkz4h3jFLHfpEEhKlTz49RHQnl24P P0/Q== X-Gm-Message-State: AIVw110eL2knMFPxLJb2VtgQDJ26+8lfaxYtNOXJ/6bnL7ph5Wrl7z5s o2gKMJ0VS6ZKhooy1xsODegGbppn4Xmq X-Received: by 10.159.34.73 with SMTP id 67mr14406507uad.90.1501597004886; Tue, 01 Aug 2017 07:16:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.85.28 with HTTP; Tue, 1 Aug 2017 07:16:04 -0700 (PDT) In-Reply-To: References: From: Keith Date: Tue, 1 Aug 2017 10:16:04 -0400 Message-ID: Subject: Re: 2 server with same configuration but huge difference in performance To: Sumeet Shukla Cc: pgsql-admin , pgsql-performance@postgresql.org Content-Type: multipart/alternative; boundary="001a113df5f812e13d0555b1cccd" 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 --001a113df5f812e13d0555b1cccd Content-Type: text/plain; charset="UTF-8" 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 --001a113df5f812e13d0555b1cccd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

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

<= font face=3D"arial, helvetica, sans-serif">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 th= e script.
On s= erver B it takes more than 20 hours. (Seems to be stuck with create index a= nd 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 serv= er that is taking longer. If it's things like CREATE INDEX or ALTER TABLE statements that are being= =20 blocked, a transaction running on the table involved will cause those=20 commands to be held until those transactions complete.

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

Keit= h
--001a113df5f812e13d0555b1cccd--