Re: First query on each connection is too slow

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: First query on each connection is too slow
Date: 2018-06-13 11:45:29
Message-ID: e070c4af-9cd7-c9ac-9c53-887a508c1074@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alex O'Ree 2018-06-13 13:21:21 Re: Merging two database dumps
Previous Message pavan95 2018-06-13 11:44:41 Re: [External] Merging two database dumps