Jons Cyriac01/27/2023, 8:11 AM
Peyton Runyan01/28/2023, 12:40 AM
Jons Cyriac01/31/2023, 4:43 AM
since logs are usually appended to storage, i think this would be a good fir for the index. I have replaced the btree index on timestamp and used BRIN instead in the log table having around 40 million records. before it used to time out everytime. And with BRIN, query response is well below a second.
BRIN stands for Block Range Index. BRIN is designed for handling very large tables in which certain columns have some natural correlation with their physical location within the table.
Peyton Runyan01/31/2023, 1:53 PM
Jons Cyriac02/01/2023, 9:49 AM
SELECT log.id, log.created, log.updated, log.name, log.level, log.flow_run_id, log.task_run_id, log.message, log.timestamp FROM log WHERE log.level >= 1::integer AND log.flow_run_id IN ('5f0ee065-7e29-41d4-8513-1327b186ddd8'::uuid) ORDER BY log.timestamp DESC LIMIT 500::integer OFFSET 0::integer