G
G
geebv2016-09-22 09:42:57
PostgreSQL
geebv, 2016-09-22 09:42:57

What database settings to configure for the following nature of queries?

Tables counters1, counters2 and datas are given. Tables countersN various counters. In datas data (binary no more than 2kb, on average 100-200 bytes).
The description of the tables is abstract, but it generally reflects the essence - the data is recorded, the counters are updated as they are recorded.
According to logic1, each operation is accompanied by an insertion into the datas table and an update of the counters in the tables counters1, counters2. Total one INSERT, two UPDATE in one transaction. In countersN tables, the same row is mostly updated) - that is, for 1000 inserted data, the same row will be updated 1000 times.
By logic2, fetching from the datas table by index (pagination) and updating countersN. That is, for a sample of 100 data, the line countersN will be updated 1 time.

-- индекс
CREATE INDEX indx ON datas(client_id asc, created_at DESC, data_id ASC);

-- первые 100 строк
WHERE client_id = 'uuid' ORDER BY created_at DESC, data_id ASC LIMIT 100;
-- вторая страница итп
WHERE client_id = 'uuid' AND (t.created_at, t.data_id) < ('2011-02-10 13:20:20.985597+06', 'uuid') ORDER BY created_at DESC, data_id ASC LIMIT 100;

It's all planned to spin on a machine with 8 cores and 16 gigs of SAS RAM. Logic
order of operations1 250 per second. The order of requests according to logic2 is about 1000 per second. The question is what database settings to tweak so that you can live with the numbers above? The figures are the estimated maximum for the next 3 months. Further, everything will grow proportionally. While not heavy loads (and studying cassandra, any other options?), postgres storage is planned. Further, as it grows - cassandra. The data table will be sorted
WITH CLUSTERING ORDER BY (created_at DESC, data_id ASC);

Any of your thoughts. Thanks

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question