ЛР 2: PostgreSQL, сессии в Valkey, трек 2

This commit is contained in:
alenchha
2026-10-19 19:11:28 +03:00
parent 65003b6119
commit 6bec450e20
50 changed files with 3210 additions and 14 deletions
+17
View File
@@ -0,0 +1,17 @@
\set ON_ERROR_STOP on
SELECT 'users' AS relation, count(*) AS rows FROM users
UNION ALL SELECT 'chats', count(*) FROM chats
UNION ALL SELECT 'chat_members', count(*) FROM chat_members
UNION ALL SELECT 'messages', count(*) FROM messages
UNION ALL SELECT 'sessions', count(*) FROM sessions
ORDER BY relation;
SELECT count(*) AS big_chat_rows,
md5(string_agg(id::text || '|' || created_at::text || '|' || encode(text, 'hex'), E'\n' ORDER BY created_at, id)) AS big_chat_md5
FROM messages WHERE chat_id = :'big_chat';
SELECT id, created_at, left(encode(text, 'escape'), 40) AS text FROM messages
WHERE chat_id = :'big_chat' ORDER BY created_at, id LIMIT 3;
SELECT count(*) AS marker_rows FROM messages WHERE position(convert_to('marker after backup', 'UTF8') in text) = 1;