Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTTfm-0000SI-76 for pgsql-admin@arkaria.postgresql.org; Wed, 22 May 2019 16:00:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hTTfk-0006AX-VS for pgsql-admin@arkaria.postgresql.org; Wed, 22 May 2019 16:00:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTTfk-00068V-Dw for pgsql-admin@lists.postgresql.org; Wed, 22 May 2019 16:00:56 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTTfh-0001SN-PF for pgsql-admin@lists.postgresql.org; Wed, 22 May 2019 16:00:55 +0000 Received: by mail-oi1-x229.google.com with SMTP id q186so2035368oia.0 for ; Wed, 22 May 2019 09:00:53 -0700 (PDT) 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=xg9VH4mYEKCE7A/jsPUGfwYl1HhlPjiXWsDJ4B9n+s4=; b=k+ENR/7TdMHdsCIz5l5/OxQLzgkR3FdW9dL320fFc45tUTg1H6UzOrrhNyT3iJVCGx NJ8UHBEojmaaFtmow3PLMjh9arCjKGETGuv+9bP/RK0FAUtcnEF4XZXwSDtrD5mb5fAr xYWyN9YPxJEVrBLMHW9l+K4LFYRPZe6nZCVfi7dSc7T8V5y1Sq0v1SUJpfl6ooedcFsU WtcfN6ZuYFOvJcyDUpZw1YjORwTomYw2MwxwZjLuhOdAiM5cLi1jqP2wbEb7pLOOTT2t NsnwiZxfbZT1EKs1dwt1EFUA5dvmGLvqSqyNlZe6klO2ArB++7jspO0eV+j0LmlvnFNm FLEw== 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=xg9VH4mYEKCE7A/jsPUGfwYl1HhlPjiXWsDJ4B9n+s4=; b=bswYcqA3aEmip4+D8PsV497tbHUBr2Pd0/g2Gpi+QWDZXI6z3XS60Aa5g8IKU98yr9 qhHPfhEhNO+DCYFdEvTdEADHNYFS0fg+oUzWbFHdVECAs8BgXFueyFZk9lAnZdTppHEW 9wUjgrtq8Sdm6MEXBBEvcC+17l1Y+TP2ZNUrdgr66iJMICfFhrdMyoRkaZ7kJxZTtNCk Qz7jIh9DIKqtc3LJAVSAdp5H0cQKPhimlbDtmQkmgM55V2rmmBUfBUur4EbaKCvImjfC y/VtSRHvTtthoVbjFrMWhgyqRljHEJlsqqmknvASWwY3yOV0jaF7H1IaZpGscGKOeXms abOQ== X-Gm-Message-State: APjAAAX0X1Gy+8FP6Pq6lMU2j/hDddB9vokVcnnhJjToqRukFUAYvK46 yU4KT9GhantvN05OV8ayuVChgFCs77c= X-Google-Smtp-Source: APXvYqwdEttO3yKV/Z074zlP9iLli677Ue+1+r4J5U1fyGivNwTqHdYb2B0s2TbYlK+oFdETrTiu0w== X-Received: by 2002:aca:ac45:: with SMTP id v66mr2331490oie.127.1558540852679; Wed, 22 May 2019 09:00:52 -0700 (PDT) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id r23sm8782193otg.49.2019.05.22.09.00.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 May 2019 09:00:52 -0700 (PDT) Subject: Re: pg_restore takes more time on creation of rules To: pgsql-admin@lists.postgresql.org References: <20190522154102.zpvieebklnvis5u3@development> From: Ron Message-ID: <3a350cb9-aeca-e858-2c8b-3481080d1dcf@gmail.com> Date: Wed, 22 May 2019 11:00:51 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------F9C4168CE5E578A32E2255A4" 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. --------------F9C4168CE5E578A32E2255A4 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit I'd redirect stderr to a file and tail it to monitor progress. On 5/22/19 10:44 AM, Mariel Cherkassky wrote: > By rules I mean DB rules (simillar to triggers but different) > > ‫בתאריך יום ד׳, 22 במאי 2019 ב-18:41 מאת ‪Tomas Vondra‬‏ > <‪tomas.vondra@2ndquadrant.com ‬‏>:‬ > > On Wed, May 22, 2019 at 06:26:49PM +0300, Mariel Cherkassky wrote: > >Hey, > >I'm trying to restore a cluster (9.2) from 3 binary dumps (pg_dump -Fc). > >Each dump contains only one database. > >The sizes : > >A-10GB > >B-20GB > >C-5GB. > > > >For unclear reason the restore of the third database is taking alot of > >time. It isnt stuck but it continues creating db rules. This database has > >more then 400K rules. > > > > What do you mean by "rules"? > > >I changed a few postgresql.conf parameters : > >shared_buffers = 2GB > >effective_cache_size = 65GB > >checkpoint_segments =20 > >checkpoint_completion_target = 0.9 > >maintenance_work_mem = 10GB > >checkpoint_timeout=30min > >work_mem=64MB > >autovacuum = off > >full_page_writes=off > >wal_buffers=50MB > > > >my machine has 31 cpu and 130GB of ram. > > > >Any idea why the restore of the two dbs takes about 15 minutes while the > >third db which is the smallest takes more than 1 hour ?  I restore the > >dump with pg_restore with 5 jobs (-j). > > > > Well, presumably the third database has complexity in other places, > possibly spending a lot of time on CPU, while the other databases don't > have such issue. > > What would help is a CPU profile, e.g. from perf. > > > regards > > -- > Tomas Vondra http://www.2ndQuadrant.com > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services > -- Angular momentum makes the world go 'round. --------------F9C4168CE5E578A32E2255A4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit I'd redirect stderr to a file and tail it to monitor progress.

On 5/22/19 10:44 AM, Mariel Cherkassky wrote:
By rules I mean DB rules (simillar to triggers but different)

‫בתאריך יום ד׳, 22 במאי 2019 ב-18:41 מאת ‪Tomas Vondra‬‏ <‪tomas.vondra@2ndquadrant.com‬‏>:‬
On Wed, May 22, 2019 at 06:26:49PM +0300, Mariel Cherkassky wrote:
>Hey,
>I'm trying to restore a cluster (9.2) from 3 binary dumps (pg_dump -Fc).
>Each dump contains only one database.
>The sizes :
>A-10GB
>B-20GB
>C-5GB.
>
>For unclear reason the restore of the third database is taking alot of
>time. It isnt stuck but it continues creating db rules. This database has
>more then 400K rules.
>

What do you mean by "rules"?

>I changed a few postgresql.conf parameters :
>shared_buffers = 2GB
>effective_cache_size = 65GB
>checkpoint_segments =20
>checkpoint_completion_target = 0.9
>maintenance_work_mem = 10GB
>checkpoint_timeout=30min
>work_mem=64MB
>autovacuum = off
>full_page_writes=off
>wal_buffers=50MB
>
>my machine has 31 cpu and 130GB of ram.
>
>Any idea why the restore of the two dbs takes about 15 minutes while the
>third db which is the smallest takes more than 1 hour ?  I restore the
>dump with pg_restore with 5 jobs (-j).
>

Well, presumably the third database has complexity in other places,
possibly spending a lot of time on CPU, while the other databases don't
have such issue.

What would help is a CPU profile, e.g. from perf.


regards

--
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


--
Angular momentum makes the world go 'round.
--------------F9C4168CE5E578A32E2255A4--