explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FybE

Settings
# exclusive inclusive rows x rows loops node
1. 0.076 3,759.442 ↑ 1.0 1 1

Aggregate (cost=1,210,256,893.05..1,210,256,893.06 rows=1 width=8) (actual time=3,759.442..3,759.442 rows=1 loops=1)

2. 2.858 3,759.366 ↑ 3.6 1,133 1

Unique (cost=1,210,256,812.03..1,210,256,842.41 rows=4,051 width=60) (actual time=3,755.220..3,759.366 rows=1,133 loops=1)

3. 19.667 3,756.508 ↓ 5.3 21,562 1

Sort (cost=1,210,256,812.03..1,210,256,822.16 rows=4,051 width=60) (actual time=3,755.219..3,756.508 rows=21,562 loops=1)

  • Sort Key: api_upload.system_uuid, api_report.rule_id
  • Sort Method: quicksort Memory: 2,453kB
4. 2,050.807 3,736.841 ↓ 5.3 21,562 1

Nested Loop (cost=12.84..1,210,256,569.30 rows=4,051 width=60) (actual time=241.853..3,736.841 rows=21,562 loops=1)

  • Join Filter: (api_report.rule_id = api_rule.id)
  • Rows Removed by Join Filter: 21,490,347
5. 10.568 489.787 ↓ 6.9 30,673 1

Nested Loop (cost=12.84..1,210,190,705.33 rows=4,427 width=20) (actual time=240.782..489.787 rows=30,673 loops=1)

6. 281.021 281.021 ↓ 1.7 2,541 1

Index Scan using api_upload_account_checked_on_id2_index on api_upload (cost=0.56..305,232.42 rows=1,494 width=20) (actual time=240.673..281.021 rows=2,541 loops=1)

  • Index Cond: (((account)::text = '540155'::text) AND (checked_on >= '2019-02-27 00:00:00+00'::timestamp with time zone) AND (checked_on <= '2019-08-26 23:59:59+00'::timestamp with time zone))
  • Filter: (NOT is_satellite)
  • Rows Removed by Filter: 96,353
7. 75.465 198.198 ↑ 12.8 12 2,541

Index Only Scan using api_report_upload_rule_id_idx on api_report (cost=12.28..809,828.09 rows=154 width=8) (actual time=0.016..0.078 rows=12 loops=2,541)

  • Index Cond: (upload_id = api_upload.id)
  • Filter: ((NOT (hashed SubPlan 1)) AND (NOT (SubPlan 2)))
  • Rows Removed by Filter: 0
  • Heap Fetches: 0
8.          

SubPlan (for Index Only Scan)

9. 0.027 0.041 ↑ 1.0 19 1

Bitmap Heap Scan on api_ack u0 (cost=4.42..11.66 rows=19 width=4) (actual time=0.021..0.041 rows=19 loops=1)

  • Recheck Cond: ((account)::text = '540155'::text)
  • Heap Blocks: exact=4
10. 0.014 0.014 ↓ 1.1 21 1

Bitmap Index Scan on api_ack_account_0fd242e7_like (cost=0.00..4.42 rows=19 width=0) (actual time=0.014..0.014 rows=21 loops=1)

  • Index Cond: ((account)::text = '540155'::text)
11. 61.346 122.692 ↓ 0.0 0 30,673

Sort (cost=1,316.71..1,316.73 rows=9 width=85) (actual time=0.004..0.004 rows=0 loops=30,673)

  • Sort Key: u1.rule_id, api_upload_1.system_uuid, api_upload_1.checked_on
  • Sort Method: quicksort Memory: 25kB
12. 0.000 61.346 ↓ 0.0 0 30,673

Nested Loop (cost=11.15..1,316.57 rows=9 width=85) (actual time=0.002..0.002 rows=0 loops=30,673)

13. 30.673 61.346 ↓ 0.0 0 30,673

Nested Loop (cost=10.57..832.85 rows=204 width=89) (actual time=0.002..0.002 rows=0 loops=30,673)

14. 0.000 30.673 ↓ 0.0 0 30,673

Nested Loop (cost=0.43..16.48 rows=1 width=77) (actual time=0.001..0.001 rows=0 loops=30,673)

15. 30.673 30.673 ↓ 0.0 0 30,673

Index Only Scan using api_hostack_rule_id_account_system_uuid_91ea3cb1_uniq on api_hostack u2 (cost=0.15..8.17 rows=1 width=20) (actual time=0.001..0.001 rows=0 loops=30,673)

  • Index Cond: ((rule_id = api_report.rule_id) AND (account = '540155'::text))
  • Heap Fetches: 0
16. 0.000 0.000 ↓ 0.0 0

Index Scan using api_rule_pkey on api_rule u1 (cost=0.28..8.29 rows=1 width=61) (never executed)

  • Index Cond: (id = api_report.rule_id)
17. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on api_upload api_upload_1 (cost=10.15..814.33 rows=204 width=28) (never executed)

  • Recheck Cond: (system_uuid = u2.system_uuid)
18. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on api_upload_system_uuid_source_id_checked_on_feb91ea9_uniq (cost=0.00..10.09 rows=204 width=0) (never executed)

  • Index Cond: (system_uuid = u2.system_uuid)
19. 0.000 0.000 ↓ 0.0 0

Index Only Scan using api_report_upload_rule_id_idx on api_report u0_1 (cost=0.57..4.17 rows=2 width=12) (never executed)

  • Index Cond: ((upload_id = api_upload_1.id) AND (rule_id = api_report.rule_id))
  • Heap Fetches: 0
20. 1,195.480 1,196.247 ↑ 1.4 701 30,673

Materialize (cost=0.00..184.77 rows=990 width=4) (actual time=0.000..0.039 rows=701 loops=30,673)

21. 0.767 0.767 ↑ 1.0 985 1

Seq Scan on api_rule (cost=0.00..179.82 rows=990 width=4) (actual time=0.007..0.767 rows=985 loops=1)

  • Filter: active
  • Rows Removed by Filter: 91
Planning time : 1.981 ms
Execution time : 3,759.537 ms