S
S
Sergey Degtyar2019-06-25 14:27:37
PostgreSQL
Sergey Degtyar, 2019-06-25 14:27:37

How to optimize postgres performance due to slow queries?

There is a project which uses the postgres database. There are two servers one combat second test.
On the test, the project is in docker. And on the combat base lies on a separate server with 4 cores and 8 GB of memory (VPS).
We started optimizing server performance and catching slow requests. There are requests which are fulfilled for 10 seconds. We started testing the same casts on the test server, they run for 100 ms.
The main server is not heavily loaded.
The bases are identical.
Where to dig and what could be the snag? How to find a bottleneck

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2019-06-25
@sergey-gornostaev

UseEXPLAIN ANALYZE

M
Maxim Fedorov, 2019-06-25
@Maksclub

The performance depends not only on indexes, if for 10 seconds - queries can be stupid due to locks ... That is, the request is just waiting for unlocking
Somewhere or transactions do not work as they should or something else, that's why you don’t find
(! if EXPLAIN is the same, of course) differences... or something like that, the difference is due to the fact that the real load is in combat, and on the test you test only what you need ...
By the way, because some commands are combat traffic (well, a copy of it) is allowed on the test bench to catch bugs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question