Реализовал уровень 4: Redis-кэш, проверки отказов и индекс истории

This commit is contained in:
2026-10-09 14:19:48 +03:00
parent 6fba9410d5
commit 64f2a5b468
16 changed files with 321 additions and 8 deletions
+76
View File
@@ -0,0 +1,76 @@
{
"rows": 10000,
"query": "SELECT * FROM messages WHERE chat_id=%s AND (created_at,id)>(%s,%s) ORDER BY created_at,id LIMIT 51",
"plan": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.29,
"Total Cost": 12.94,
"Plan Rows": 51,
"Plan Width": 87,
"Actual Startup Time": 0.017,
"Actual Total Time": 0.025,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 5,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history_idx",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.29,
"Total Cost": 536.25,
"Plan Rows": 2160,
"Plan Width": 87,
"Actual Startup Time": 0.016,
"Actual Total Time": 0.021,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "((chat_id = '44cfe328-842b-43a5-900b-ff083cb13f7f'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.008001+00'::timestamp with time zone, '10e68164-4b26-406f-a3a4-f0395ca68f52'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 5,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 108,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.516,
"Triggers": [],
"Execution Time": 0.08
}
}