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 1hq0L6-0001CO-2a for pgsql-general@arkaria.postgresql.org; Tue, 23 Jul 2019 19:20:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hq0L4-0003Uh-IQ for pgsql-general@arkaria.postgresql.org; Tue, 23 Jul 2019 19:20:42 +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 1hq0L4-0003MP-28 for pgsql-general@lists.postgresql.org; Tue, 23 Jul 2019 19:20:42 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1hq0L0-0005t3-GI for pgsql-general@postgresql.org; Tue, 23 Jul 2019 19:20:40 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 10F7615B6DD0D for ; Tue, 23 Jul 2019 12:20:34 -0700 (MST) Date: Tue, 23 Jul 2019 12:20:33 -0700 (MST) From: PegoraroF10 To: pgsql-general@postgresql.org Message-ID: <1563909633976-0.post@n3.nabble.com> Subject: Too slow to create new schema and their tables, functions, triggers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk We have in a single database 190 identical schemas. Now, when we create a n= ew one, with exactly same structure as the previous ones, it takes 20 or 30 minutes to finish. Usual time to finish that script was 30 seconds. Basically, my script creates an entire structure for a new customer: - Create schema TempSchema; --just to be sure that nobody will connect unti= l it finishes - create tables (100), constraints, functions, etc. - import data using restore only data. - rename TempSchema to production name. On second step, when creating tables, functions and so on, it takes sometimes a minute just to create one table or one function. So, does this happens because we have almost 200 schemas on that database ? I=C2=B4m almost sure about. What do I need do to run my script as before ? Do I need to Reindex ? Vacuu= m ? Or am I reaching a limit in a number of schemas in a Postgres database ? -- Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.h= tml