explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bEFl : Limit (cost=158794.91..158794.92 rows=4 width=1233) -> Sort (cost=158794.91..158794.92 rows=4 width=1233) Sort Key: n.date_in DESC -> WindowAgg (cost=115237.30..158794.87 rows=4 width=1233) -> Nested Loop Left Join (cost=115237.30..158794.82 rows=4 width=1225) -> Nested Loop Left Join (cost=115236.88..158761.06 rows=4 width=1224) Join Filter: (n.id = nh2.notice_id) -> Nested Loop Left Join (cost=100409.77..143468.66 rows=4 width=1216) -> Bitmap Heap Scan on notice n (cost=51.95..67.98 rows=4 width=1204) Recheck Cond: ((date_in >= '2019-05-01 00:00:00'::timestamp without time zone) AND (date_in <= '2019-05-31 00:00:00'::timestamp without time zone) AND ((region)::text = '52'::text)) Filter: ("r$notice_status_id" <> ALL ('{1,8,11}'::integer[])) -> BitmapAnd (cost=51.95..51.95 rows=4 width=0) -> Bitmap Index Scan on idx_notice__date_in (cost=0.00..21.36 rows=894 width=0) Index Cond: ((date_in >= '2019-05-01 00:00:00'::timestamp without time zone) AND (date_in <= '2019-05-31 00:00:00'::timestamp without time zone)) -> Bitmap Index Scan on idx_notice_region (cost=0.00..30.33 rows=2388 width=0) Index Cond: ((region)::text = '52'::text) -> Hash Join (cost=100357.82..111118.53 rows=1 width=20) Hash Cond: ((min(nh_1.id)) = nh.id) -> GroupAggregate (cost=100341.42..107074.06 rows=319054 width=16) Group Key: nh_1.notice_id -> Sort (cost=100341.42..101522.12 rows=472281 width=16) Sort Key: nh_1.notice_id -> Bitmap Heap Scan on notice_history nh_1 (cost=9116.61..47756.12 rows=472281 width=16) Recheck Cond: ("r$notice_status_id" = 2) -> Bitmap Index Scan on idx_notice_history_notice_status_id (cost=0.00..8998.53 rows=472281 width=0) Index Cond: ("r$notice_status_id" = 2) -> Hash (cost=16.37..16.37 rows=3 width=28) -> Index Scan using idx_notice_history_notice_id on notice_history nh (cost=0.43..16.37 rows=3 width=28) Index Cond: (n.id = notice_id) -> Materialize (cost=14827.11..14968.11 rows=5640 width=16) -> HashAggregate (cost=14827.11..14883.51 rows=5640 width=16) Group Key: nh2.notice_id -> Bitmap Heap Scan on notice_history nh2 (cost=112.34..14798.78 rows=5666 width=16) Recheck Cond: ("r$notice_status_id" = 11) -> Bitmap Index Scan on idx_notice_history_notice_status_id (cost=0.00..110.92 rows=5666 width=0) Index Cond: ("r$notice_status_id" = 11) -> Index Scan using missing_address_pkey on missing_address ma (cost=0.42..8.44 rows=1 width=9) Index Cond: (id = n.missing_address_id)

Settings
# exclusive inclusive rows x rows loops node
1. 0.158 55.012 ↑ 11.4 71 1

Sort (cost=146.63..148.65 rows=808 width=138) (actual time=55.009..55.012 rows=71 loops=1)

  • Sort Key: n.nspname, p.proname, (pg_get_function_arguments(p.oid))
  • Sort Method: quicksort Memory: 43kB
2. 1.378 54.854 ↑ 11.4 71 1

Hash Join (cost=1.14..107.61 rows=808 width=138) (actual time=42.495..54.854 rows=71 loops=1)

  • Hash Cond: (p.pronamespace = n.oid)
3. 53.465 53.465 ↓ 3.0 2,402 1

Seq Scan on pg_proc p (cost=0.00..89.30 rows=808 width=78) (actual time=0.052..53.465 rows=2,402 loops=1)

  • Filter: pg_function_is_visible(oid)
4. 0.004 0.011 ↑ 1.0 4 1

Hash (cost=1.09..1.09 rows=4 width=68) (actual time=0.011..0.011 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
5. 0.007 0.007 ↑ 1.0 4 1

Seq Scan on pg_namespace n (cost=0.00..1.09 rows=4 width=68) (actual time=0.005..0.007 rows=4 loops=1)

  • Filter: ((nspname <> 'pg_catalog'::name) AND (nspname <> 'information_schema'::name))