{"hot_chat_id": "a10c30fb-faf7-4cae-ae8c-15ebde54d7e9", "messages": 10000, "chats": ["a10c30fb-faf7-4cae-ae8c-15ebde54d7e9", "64cb41c4-95b7-4327-a8f7-c9cfda051057", "995f3cbc-f0cf-42bc-acea-bbbb27389434"]} hot_chat_id=a10c30fb-faf7-4cae-ae8c-15ebde54d7e9 === EXPLAIN keyset query === QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Limit (cost=18.69..18.70 rows=4 width=106) (actual time=0.870..0.875 rows=50 loops=1) Buffers: shared hit=87 -> Sort (cost=18.69..18.70 rows=4 width=106) (actual time=0.869..0.871 rows=50 loops=1) Sort Key: created_at, id Sort Method: top-N heapsort Memory: 36kB Buffers: shared hit=87 -> Bitmap Heap Scan on messages (cost=4.32..18.65 rows=4 width=106) (actual time=0.223..0.520 rows=3333 loops=1) Recheck Cond: ((chat_id = 'a10c30fb-faf7-4cae-ae8c-15ebde54d7e9'::uuid) AND (ROW(created_at, id) > ROW('2020-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))) Heap Blocks: exact=48 Buffers: shared hit=81 -> Bitmap Index Scan on messages_chat_created_id_idx (cost=0.00..4.32 rows=4 width=0) (actual time=0.209..0.209 rows=3333 loops=1) Index Cond: ((chat_id = 'a10c30fb-faf7-4cae-ae8c-15ebde54d7e9'::uuid) AND (ROW(created_at, id) > ROW('2020-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))) Buffers: shared hit=33 Planning: Buffers: shared hit=136 Planning Time: 0.313 ms Execution Time: 0.907 ms (17 rows)