ЛР 2: мессенджер на PostgreSQL и сессии в Redis
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
2026-10-23 12:16:56 +03:00
parent 65003b6119
commit 1dd701be2b
69 changed files with 2163 additions and 30 deletions
+38
View File
@@ -0,0 +1,38 @@
BEGIN;
INSERT INTO users (id, username, display_name, password_hash, created_at)
VALUES (
'11111111-1111-1111-1111-111111111111',
'explain_user',
'EXPLAIN user',
'not-used-by-this-query',
TIMESTAMPTZ '2026-01-01 00:00:00+00'
);
INSERT INTO chats (id, title, created_at)
VALUES (
'22222222-2222-2222-2222-222222222222',
'EXPLAIN history',
TIMESTAMPTZ '2026-01-01 00:00:00+00'
);
INSERT INTO chat_members (chat_id, user_id)
VALUES ('22222222-2222-2222-2222-222222222222', '11111111-1111-1111-1111-111111111111');
INSERT INTO messages (id, chat_id, sender_id, text, created_at)
SELECT
md5('explain-message-' || number)::uuid,
'22222222-2222-2222-2222-222222222222',
'11111111-1111-1111-1111-111111111111',
'EXPLAIN message ' || number,
TIMESTAMPTZ '2026-01-01 00:00:00+00' + number * INTERVAL '1 second'
FROM generate_series(1, 10000) AS number;
EXPLAIN (ANALYZE, BUFFERS, COSTS OFF)
SELECT id, chat_id, sender_id, text, created_at
FROM messages
WHERE chat_id = '22222222-2222-2222-2222-222222222222'
ORDER BY created_at, id
LIMIT 100;
ROLLBACK;