explain.depesz.com

PostgreSQL's explain analyze made readable

Result: pjGr

Settings
# exclusive inclusive rows x rows loops node
1. 0.293 465.398 ↑ 1.0 1 1

Limit (cost=57,599.76..57,599.76 rows=1 width=8) (actual time=465.106..465.398 rows=1 loops=1)

2. 0.057 465.105 ↑ 14,626.0 1 1

Sort (cost=57,599.76..57,636.32 rows=14,626 width=8) (actual time=465.105..465.105 rows=1 loops=1)

  • Sort Key: (count(tc.id)) DESC
  • Sort Method: top-N heapsort Memory: 25kB
3. 2.280 465.048 ↑ 29.1 502 1

Hash Join (cost=56,934.25..57,526.63 rows=14,626 width=8) (actual time=457.376..465.048 rows=502 loops=1)

  • Hash Cond: (tc.id = ticket_information.ticket_id)
4. 17.840 405.965 ↓ 1.1 27,506 1

Finalize HashAggregate (cost=55,511.28..55,772.46 rows=26,118 width=12) (actual time=400.561..405.965 rows=27,506 loops=1)

  • Group Key: tc.id
5. 3.047 388.125 ↑ 1.9 27,506 1

Gather (cost=1,001.27..55,250.10 rows=52,236 width=12) (actual time=0.502..388.125 rows=27,506 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 6.772 385.078 ↑ 2.8 9,169 3

Partial GroupAggregate (cost=1.27..49,026.50 rows=26,118 width=12) (actual time=0.182..385.078 rows=9,169 loops=3)

  • Group Key: tc.id
7. 214.308 378.306 ↑ 1.2 25,758 3

Nested Loop Left Join (cost=1.27..48,615.56 rows=29,952 width=4) (actual time=0.129..378.306 rows=25,758 loops=3)

8. 127.276 163.990 ↑ 1.2 25,756 3

Nested Loop (cost=0.85..24,302.77 rows=29,952 width=8) (actual time=0.087..163.990 rows=25,756 loops=3)

9. 36.701 36.701 ↑ 1.2 9,169 3

Parallel Index Scan using tickets_pkey on tickets tc (cost=0.42..5,867.97 rows=10,882 width=4) (actual time=0.026..36.701 rows=9,169 loops=3)

  • Filter: (queue = 4)
  • Rows Removed by Filter: 39738
10. 0.013 0.013 ↑ 1.0 3 27,508

Index Scan using transactions2 on transactions tx (cost=0.43..1.66 rows=3 width=8) (actual time=0.006..0.013 rows=3 loops=27,508)

  • Index Cond: (objectid = tc.id)
  • Filter: (((objecttype)::text = 'RT::Ticket'::text) AND (((type)::text = 'Correspond'::text) OR ((type)::text = 'Comment'::text) OR ((type)::text = 'Create'::text)))
  • Rows Removed by Filter: 7
11. 0.008 0.008 ↓ 0.0 0 77,269

Index Scan using attachments2 on attachments (cost=0.42..0.80 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=77,269)

  • Index Cond: (transactionid = tx.id)
  • Filter: (((contenttype)::text = 'text/plain'::text) AND ((contentencoding)::text = 'quoted-printable'::text))
  • Rows Removed by Filter: 1
12. 0.063 56.803 ↓ 4.8 540 1

Hash (cost=1,421.57..1,421.57 rows=112 width=4) (actual time=56.803..56.803 rows=540 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
13. 0.044 56.740 ↓ 4.8 540 1

Subquery Scan on ticket_information (cost=1,418.22..1,421.57 rows=112 width=4) (actual time=55.827..56.740 rows=540 loops=1)

14. 0.548 56.696 ↓ 4.8 540 1

GroupAggregate (cost=1,418.22..1,420.45 rows=112 width=210) (actual time=55.826..56.696 rows=540 loops=1)

  • Group Key: tc_1.id
15. 1.912 56.148 ↓ 29.7 6,560 1

Sort (cost=1,418.22..1,418.77 rows=221 width=4) (actual time=55.820..56.148 rows=6,560 loops=1)

  • Sort Key: tc_1.id
  • Sort Method: quicksort Memory: 500kB
16. 3.267 54.236 ↓ 29.7 6,560 1

Nested Loop (cost=1.27..1,409.62 rows=221 width=4) (actual time=0.111..54.236 rows=6,560 loops=1)

17. 1.536 14.041 ↓ 15.3 9,232 1

Nested Loop (cost=0.85..997.60 rows=605 width=8) (actual time=0.091..14.041 rows=9,232 loops=1)

18. 1.144 1.144 ↓ 4.8 541 1

Index Scan using tickets2 on tickets tc_1 (cost=0.42..342.62 rows=112 width=4) (actual time=0.055..1.144 rows=541 loops=1)

  • Index Cond: (owner = 510674)
  • Filter: (((status)::text = 'resolved'::text) AND (timezone('Europe/Oslo'::text, timezone('UTC'::text, resolved)) <= now()))
  • Rows Removed by Filter: 18
19. 11.361 11.361 ↓ 3.4 17 541

Index Scan using transactions1 on transactions tx_1 (cost=0.43..5.80 rows=5 width=8) (actual time=0.010..0.021 rows=17 loops=541)

  • Index Cond: (((objecttype)::text = 'RT::Ticket'::text) AND (objectid = tc_1.id))
20. 36.928 36.928 ↑ 3.0 1 9,232

Index Scan using attachments2 on attachments a (cost=0.42..0.65 rows=3 width=4) (actual time=0.004..0.004 rows=1 loops=9,232)

  • Index Cond: (transactionid = tx_1.id)
  • Filter: ((contenttype)::text = 'text/plain'::text)
  • Rows Removed by Filter: 0