QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Nested Loop (cost=0.42..5768.94 rows=11004 width=8) (actual time=0.062..14.308 rows=8919 loops=1) Join Filter: (s.m_fk = m.pk) Buffers: shared hit=3130 read=386 -> Seq Scan on m (cost=0.00..1.01 rows=1 width=8) (actual time=0.004..0.006 rows=1 loops=1) Filter: (status = 'A'::text) Buffers: shared hit=1 -> Index Scan using s_pk_action_at on s (cost=0.42..5630.38 rows=11004 width=16) (actual time=0.056..13.012 rows=8919 loops=1) Index Cond: (action_at <= '2018-09-06'::date) Filter: (status = ANY ('{A,P}'::text[])) Rows Removed by Filter: 4483 Buffers: shared hit=3129 read=386 Planning Time: 0.704 ms Execution Time: 14.843 ms (13 rows)