feat: implement persistent messenger with PostgreSQL and Redis
Skeleton contracts / contracts (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
Timing is on.
|
||||
ANALYZE
|
||||
Time: 119.924 ms
|
||||
chat_id | messages_count
|
||||
--------------------------------------+----------------
|
||||
f68eff95-e44f-4c79-997c-49eb725cfb4d | 90005
|
||||
b14d0a4f-3046-44b2-871e-4ebfb752c543 | 11613
|
||||
1b7b678e-d262-4d61-8167-7fc8b736f3ff | 10005
|
||||
baabd1bb-8b74-41dd-9bcf-d801d31c160c | 5
|
||||
aeed09d0-85e4-41c2-a77b-b2c2dd6a0de3 | 5
|
||||
(5 rows)
|
||||
|
||||
Time: 9.632 ms
|
||||
Time: 8.499 ms
|
||||
TEST A: existing composite index
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Limit (cost=0.42..5.86 rows=50 width=46) (actual time=0.007..0.014 rows=50 loops=1)
|
||||
Buffers: shared hit=5
|
||||
-> Index Scan using idx_messages_chat_created_id on messages (cost=0.42..9781.28 rows=89792 width=46) (actual time=0.006..0.011 rows=50 loops=1)
|
||||
Index Cond: (chat_id = 'f68eff95-e44f-4c79-997c-49eb725cfb4d'::uuid)
|
||||
Buffers: shared hit=5
|
||||
Planning:
|
||||
Buffers: shared hit=9
|
||||
Planning Time: 0.042 ms
|
||||
Execution Time: 0.021 ms
|
||||
(9 rows)
|
||||
|
||||
Time: 0.314 ms
|
||||
TEST B: additional index
|
||||
CREATE INDEX
|
||||
Time: 40.624 ms
|
||||
ANALYZE
|
||||
Time: 116.772 ms
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Limit (cost=0.42..5.84 rows=50 width=46) (actual time=0.018..0.026 rows=50 loops=1)
|
||||
Buffers: shared hit=5
|
||||
-> Index Scan using idx_messages_chat_created_id on messages (cost=0.42..9765.59 rows=90101 width=46) (actual time=0.017..0.023 rows=50 loops=1)
|
||||
Index Cond: (chat_id = 'f68eff95-e44f-4c79-997c-49eb725cfb4d'::uuid)
|
||||
Buffers: shared hit=5
|
||||
Planning:
|
||||
Buffers: shared hit=14 read=1
|
||||
Planning Time: 0.125 ms
|
||||
Execution Time: 0.043 ms
|
||||
(9 rows)
|
||||
|
||||
Time: 0.372 ms
|
||||
Index sizes
|
||||
indexrelname | size
|
||||
------------------------------+---------
|
||||
idx_messages_chat_created_id | 7424 kB
|
||||
idx_messages_chat_id_only | 784 kB
|
||||
messages_pkey | 4432 kB
|
||||
(3 rows)
|
||||
|
||||
Time: 1.309 ms
|
||||
Reference in New Issue
Block a user