forked from mtusi2026/mtusi2026lab2
Реализовать лабораторную 2: API мессенджера с PostgreSQL и кэшем сессий
FastAPI-сервис с opaque-сессиями (Argon2id, SHA-256 фингерпринт), PostgreSQL как источником истины, Valkey как кэшем сессий, keyset-пагинацией, пулом соединений и таймаутами. Добавлены миграции, compose-стенд, скрипт рестарта, студенческие проверки и evidence.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
INSERT 0 0
|
||||
INSERT 0 0
|
||||
INSERT 0 0
|
||||
INSERT 0 10000
|
||||
ANALYZE
|
||||
=== message count ===
|
||||
messages
|
||||
----------
|
||||
10000
|
||||
(1 row)
|
||||
|
||||
=== EXPLAIN (ANALYZE, BUFFERS): keyset page in the middle of history ===
|
||||
QUERY PLAN
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Limit (cost=0.42..17.91 rows=50 width=70) (actual time=0.006..0.014 rows=50 loops=1)
|
||||
Buffers: shared hit=5
|
||||
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.42..1719.51 rows=4913 width=70) (actual time=0.006..0.011 rows=50 loops=1)
|
||||
Index Cond: ((chat_id = '00000000-0000-4000-8000-0000000000aa'::uuid) AND (ROW(created_at, id) > ROW((now() - '01:23:20'::interval), '00000000-0000-4000-8000-000000000000'::uuid)))
|
||||
Buffers: shared hit=5
|
||||
Planning:
|
||||
Buffers: shared hit=20
|
||||
Planning Time: 0.056 ms
|
||||
Execution Time: 0.028 ms
|
||||
(9 rows)
|
||||
|
||||
=== EXPLAIN (ANALYZE, BUFFERS): first page (no cursor) ===
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Limit (cost=0.41..11.29 rows=50 width=70) (actual time=21.930..21.937 rows=50 loops=1)
|
||||
Buffers: shared hit=266 read=126 dirtied=126
|
||||
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.41..2176.76 rows=10000 width=70) (actual time=21.929..21.933 rows=50 loops=1)
|
||||
Index Cond: (chat_id = '00000000-0000-4000-8000-0000000000aa'::uuid)
|
||||
Buffers: shared hit=266 read=126 dirtied=126
|
||||
Planning Time: 0.022 ms
|
||||
Execution Time: 21.948 ms
|
||||
(7 rows)
|
||||
|
||||
Reference in New Issue
Block a user