Re: First query on each connection is too slow - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: First query on each connection is too slow
Date
Msg-id e070c4af-9cd7-c9ac-9c53-887a508c1074@gmx.net
Whole thread Raw
In response to First query on each connection is too slow  (Vadim Nevorotin <nevorotin@gmail.com>)
List 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. 





pgsql-general by date:

Previous
From: pavan95
Date:
Subject: Re: [External] Merging two database dumps
Next
From: "Alex O'Ree"
Date:
Subject: Re: Merging two database dumps