M
M
Maxim Markin2016-06-03 14:18:44
PostgreSQL
Maxim Markin, 2016-06-03 14:18:44

How to optimize queries in PostgreSQL?

Good day.
Essence of the question: I have a server on the node, it is such a push server (tracks changes in the database and sends the necessary data to the connected client). Approximate load 1500-2000 clients. There are 7-8 requests per client per 3 seconds. Recent tests have shown that this will be a heavy load on the system, because. with 2-3 clients hanging, a regular SELECT constantly takes from 30 to 60% of the load per percent.
This, by the way, is a notification system. If someone has implemented something like this, can you give me an optimization idea?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2016-06-03
@owl1n

see EXPLAIN (ANALYZE, VERBOSE, BUFFERS)all requests.
In general, you don’t need to track changes, make triggers.

L
lega, 2016-06-03
@lega

it is such a push server (monitors changes in the database and sends the necessary data to the connected client

Selects are not needed, let the code that changes the data in the database send messages through rabbitmq/zmq, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question