Answer the question
In order to leave comments, you need to log in
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;
WITH CLUSTERING ORDER BY (created_at DESC, data_id ASC);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question