I am new to PostgreSQL optimization and choose any suitable job for it and what not. So I want to know when I try to use PostgreSQL for inadequate work, or is suitable for it, and I have to configure everything correctly.
Anyway, I need a database with lots of data that change frequently.
For example, imagine an Internet service provider that has many clients, each of which has a session (PPP / VPN / whatever), with two self-describing, frequently updated properties, bytes_received and bytes_sent . There is a table with them, where each session is represented by a line with a unique identifier:
CREATE TABLE sessions( id BIGSERIAL NOT NULL, username CHARACTER VARYING(32) NOT NULL, some_connection_data BYTEA NOT NULL, bytes_received BIGINT NOT NULL, bytes_sent BIGINT NOT NULL, CONSTRAINT sessions_pkey PRIMARY KEY (id) )
And as accounting data streams, this table receives many UPDATES, such as:
When we get an endless stream with quite a few (for example, 1-2 per second) updates for a table with a lot of (for example, several thousand) sessions, probably thanks to MVCC, this makes PostgreSQL very busy. Is there a way to speed things up, or is Postgres just not suitable for this task, and I would find it unsuitable for this job and put these counters in another repository, like memcachedb, using Postgres only for pretty static data? But I will miss the opportunity to rarely request this data, for example, to find the TOP10 loaders, which is not very good.
Unfortunately, the amount of data cannot be significantly reduced. The ISP calculation example is intended to simplify the explanation. The real problem is with another system, the structure of which is somehow more difficult to explain.
Thanks for the suggestions!