explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kZRL

Settings
# exclusive inclusive rows x rows loops node
1. 0.120 125.298 ↑ 3.4 99 1

Sort (cost=18,870.30..18,871.15 rows=340 width=12) (actual time=125.291..125.298 rows=99 loops=1)

  • Sort Key: (count(DISTINCT api_upload.system_uuid))
  • Sort Method: quicksort Memory: 29kB
2. 33.441 125.178 ↑ 3.4 99 1

GroupAggregate (cost=18,129.58..18,856.00 rows=340 width=12) (actual time=48.872..125.178 rows=99 loops=1)

  • Group Key: api_rule.id
3. 0.000 91.737 ↓ 14.2 78,493 1

Gather Merge (cost=18,129.58..18,824.91 rows=5,538 width=20) (actual time=47.883..91.737 rows=78,493 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 26.535 175.353 ↓ 11.3 26,164 3

Merge Join (cost=17,129.56..17,185.67 rows=2,308 width=20) (actual time=44.012..58.451 rows=26,164 loops=3)

  • Merge Cond: (api_report.rule_id = api_rule.id)
5. 53.805 145.299 ↓ 5.3 33,333 3

Sort (cost=16,944.51..16,960.19 rows=6,271 width=20) (actual time=42.915..48.433 rows=33,333 loops=3)

  • Sort Key: api_report.rule_id
  • Sort Method: quicksort Memory: 3767kB
6. 24.975 91.494 ↓ 5.3 33,333 3

Nested Loop (cost=209.01..16,548.98 rows=6,271 width=20) (actual time=0.621..30.498 rows=33,333 loops=3)

7. 5.062 6.519 ↓ 7.4 3,333 3

Parallel Bitmap Heap Scan on api_upload (cost=208.58..11,331.28 rows=448 width=20) (actual time=0.552..2.173 rows=3,333 loops=3)

  • Recheck Cond: ((account)::text = '0'::text)
  • Filter: current
  • Heap Blocks: exact=34
8. 1.457 1.457 ↓ 1.0 10,000 1

Bitmap Index Scan on api_upload_account_e808b66a_like (cost=0.00..208.31 rows=9,584 width=0) (actual time=1.457..1.457 rows=10,000 loops=1)

  • Index Cond: ((account)::text = '0'::text)
9. 60.000 60.000 ↑ 26.4 10 10,000

Index Only Scan using api_report_upload_id_rule_id_1a55a613_uniq on api_report (cost=0.43..9.01 rows=264 width=8) (actual time=0.003..0.006 rows=10 loops=10,000)

  • Index Cond: (upload_id = api_upload.id)
  • Heap Fetches: 0
10. 0.861 3.519 ↓ 1.9 639 3

Sort (cost=185.05..185.90 rows=340 width=4) (actual time=1.093..1.173 rows=639 loops=3)

  • Sort Key: api_rule.id
  • Sort Method: quicksort Memory: 56kB
11. 2.571 2.658 ↓ 2.0 679 3

Seq Scan on api_rule (cost=12.20..170.75 rows=340 width=4) (actual time=0.056..0.886 rows=679 loops=3)

  • Filter: (active AND (NOT (hashed SubPlan 1)))
  • Rows Removed by Filter: 245
12.          

SubPlan (forSeq Scan)

13. 0.087 0.087 ↓ 0.0 0 3

Index Scan using api_ack_account_0fd242e7 on api_ack (cost=0.28..12.20 rows=2 width=4) (actual time=0.029..0.029 rows=0 loops=3)

  • Index Cond: ((account)::text = '0'::text)