explain.depesz.com

PostgreSQL's explain analyze made readable

Result: At4h

Settings
# exclusive inclusive rows x rows loops node
1. 3.618 3,541.757 ↑ 1.0 1 1

Aggregate (cost=1,229,585,382.58..1,229,585,382.59 rows=1 width=8) (actual time=3,541.757..3,541.757 rows=1 loops=1)

2. 1,931.935 3,538.139 ↓ 5.1 21,562 1

Nested Loop (cost=12.84..1,229,585,372.04 rows=4,215 width=8) (actual time=266.523..3,538.139 rows=21,562 loops=1)

  • Join Filter: (api_report.rule_id = api_rule.id)
  • Rows Removed by Join Filter: 21,490,347
3. 9.253 471.303 ↓ 6.7 30,673 1

Nested Loop (cost=12.84..1,229,516,835.08 rows=4,607 width=12) (actual time=265.355..471.303 rows=30,673 loops=1)

4. 304.508 304.508 ↓ 1.6 2,541 1

Index Scan using upload_ais on api_upload (cost=0.56..339,068.17 rows=1,555 width=12) (actual time=265.162..304.508 rows=2,541 loops=1)

  • Index Cond: ((account)::text = '540155'::text)
  • Filter: ((NOT is_satellite) 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))
  • Rows Removed by Filter: 105,559
5. 65.456 157.542 ↑ 12.8 12 2,541

Index Only Scan using api_report_upload_rule_id_idx on api_report (cost=12.28..790,466.48 rows=154 width=8) (actual time=0.013..0.062 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
6.          

SubPlan (for Index Only Scan)

7. 0.043 0.067 ↑ 1.0 19 1

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

  • Recheck Cond: ((account)::text = '540155'::text)
  • Heap Blocks: exact=4
8. 0.024 0.024 ↓ 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.023..0.024 rows=21 loops=1)

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

Sort (cost=1,285.23..1,285.25 rows=9 width=85) (actual time=0.003..0.003 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
10. 0.000 30.673 ↓ 0.0 0 30,673

Nested Loop (cost=11.11..1,285.08 rows=9 width=85) (actual time=0.001..0.001 rows=0 loops=30,673)

11. 0.000 30.673 ↓ 0.0 0 30,673

Nested Loop (cost=10.53..813.22 rows=199 width=89) (actual time=0.001..0.001 rows=0 loops=30,673)

12. 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)

13. 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
14. 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)
15. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on api_upload api_upload_1 (cost=10.11..794.76 rows=199 width=28) (never executed)

  • Recheck Cond: (system_uuid = u2.system_uuid)
16. 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.06 rows=199 width=0) (never executed)

  • Index Cond: (system_uuid = u2.system_uuid)
17. 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
18. 1,134.063 1,134.901 ↑ 1.4 701 30,673

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

19. 0.838 0.838 ↑ 1.0 985 1

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

  • Filter: active
  • Rows Removed by Filter: 91
Planning time : 3.399 ms
Execution time : 3,541.931 ms