From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: First query on each connection is too slow
Date: Wed, 13 Jun 2018 13:45:29 +0200
Message-ID: <e070c4af-9cd7-c9ac-9c53-887a508c1074@gmx.net> (raw)
In-Reply-To: <CAF=tNg_eEVo79iAYrs_MqLQc_qWnOv8dtf_Vz+_0o=icKfkntw@mail.gmail.com>
References: <CAF=tNg_eEVo79iAYrs_MqLQc_qWnOv8dtf_Vz+_0o=icKfkntw@mail.gmail.com>
Vadim Nevorotin schrieb am 13.06.2018 um 11:55:
> I have a very strange problem. I'm using PostgreSQL 9.6 with PostGIS
> 2.3 (both from Debian Strecth repos) to store DB for OSM server (but
> actually it doesn't matter). And I've noticed, that on each new
> connection to DB first query is much slower (10x) than all others.
> E.g.:
>
> If I run others instances of psql in parallel, when the first is
> active - they has absolutely the same problem. In one instance of
> psql query is fast (if it's not the first query), in others - first
> query is slow, but all others is fast.
Do you have many(!) tables and schemas?
Caching of schema information is done per connection, so maybe the
lookup of the table in the system catalogs is what is taking so much time.
But I think you would need thousands of schemas with thousands of tables
each schema in order to notice an impact there.
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: spam_eater@gmx.net
Subject: Re: First query on each connection is too slow
In-Reply-To: <e070c4af-9cd7-c9ac-9c53-887a508c1074@gmx.net>
References: <CAF=tNg_eEVo79iAYrs_MqLQc_qWnOv8dtf_Vz+_0o=icKfkntw@mail.gmail.com> <e070c4af-9cd7-c9ac-9c53-887a508c1074@gmx.net>
* 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