pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Juan Manuel Cuello <juanmacuello@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Connection hangs on new created schema
Date: Wed, 28 Mar 2018 07:58:11 +0200
Message-ID: <1522216691.2363.13.camel@cybertec.at> (raw)
In-Reply-To: <CALXCfb094RkO5nosjUpUSXL0asSqio9XeRWHf02gX0SB4JUJGg@mail.gmail.com>
References: <CALXCfb094RkO5nosjUpUSXL0asSqio9XeRWHf02gX0SB4JUJGg@mail.gmail.com>

Juan Manuel Cuello wrote:
> I have a postgresql database with around 4000 schemas. Each schema has around
> the same 65 tables. There are 8 processes connected to the database (it is a web app).
> Each process has only one direct connection to the database (no connection pool).
> 
> Everything works ok until a new schema (with all its tables, indices, etc)
> is added to the database. When this happens, the next query made to the database
> takes too long, sometimes more than a minute o two. Also I see a high DB CPU usage
> during that lapse. Then everything continues working ok as usual and CPU drops to normal levels.
> 
> I'm mostly sure this has to do with the amount of schemas, maybe related to relcache,
> but not sure why creating new schemas causes all this and where to look to solve this problem.

If you know the slow query EXPLAIN (ANALYZE, BUFFERS) it and see where the time
is spent.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




view thread (3+ messages)  latest in thread

Message-ID: <1522216691.2363.13.camel@cybertec.at>
Permalink:  ../1522216691.2363.13.camel@cybertec.at/
Also on:    postgresql.org/message-id/1522216691.2363.13.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, juanmacuello@gmail.com
  Subject: Re: Connection hangs on new created schema
  In-Reply-To: <1522216691.2363.13.camel@cybertec.at>
  References: <CALXCfb094RkO5nosjUpUSXL0asSqio9XeRWHf02gX0SB4JUJGg@mail.gmail.com> <1522216691.2363.13.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox