explain.depesz.com

PostgreSQL's explain analyze made readable

Result: v2lg

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Unique (cost=334,650,894,996.19..334,650,905,820.73 rows=1,653,960 width=605) (actual rows= loops=)

2.          

CTE unf

3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.01..132,428.69 rows=4,122,100 width=136) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Seq Scan on raw_messages_tour_tourunforwarded u_1 (cost=0.00..8,765.69 rows=41,221 width=284) (actual rows= loops=)

  • Filter: (topic = 'tour'::text)
5. 0.000 0.000 ↓ 0.0

Function Scan on jsonb_array_elements removed (cost=0.01..1.00 rows=100 width=32) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Sort (cost=334,650,762,567.49..334,650,767,979.77 rows=2,164,909 width=605) (actual rows= loops=)

  • Sort Key: f.message, f.partition_offset DESC
7. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=154,718.52..334,649,407,370.47 rows=2,164,909 width=605) (actual rows= loops=)

  • Hash Cond: ((f.message ->> 'last_company_id'::text) = c4.company_id)
8. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=154,683.58..334,649,341,807.98 rows=2,164,909 width=369) (actual rows= loops=)

  • Hash Cond: ((((f.message -> 'forwarding_chain'::text) -> 0) ->> 'forwarded_by_company_id'::text) = c3.company_id)
9. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=154,648.64..334,649,335,232.09 rows=2,164,909 width=357) (actual rows= loops=)

  • Hash Cond: ((f.message ->> 'forwarded_to_company_id'::text) = c2.company_id)
10. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=154,613.70..334,649,329,204.60 rows=2,164,909 width=345) (actual rows= loops=)

  • Hash Cond: ((f.message ->> 'forwarded_by_company_id'::text) = c1.company_id)
11. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=154,578.76..334,649,323,177.11 rows=2,164,909 width=333) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Seq Scan on raw_messages_tour_tourforwarded f (cost=0.00..320,321.54 rows=2,164,909 width=301) (actual rows= loops=)

  • Filter: ((topic = 'tour'::text) AND ((message ->> 'forwarded_by_company_id'::text) <> (message ->> 'forwarded_to_company_id'::text)))
13. 0.000 0.000 ↓ 0.0

Limit (cost=154,578.76..154,578.77 rows=1 width=136) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Sort (cost=154,578.76..154,578.77 rows=1 width=136) (actual rows= loops=)

  • Sort Key: unf.partition_offset
15. 0.000 0.000 ↓ 0.0

CTE Scan on unf (cost=0.00..154,578.75 rows=1 width=136) (actual rows= loops=)

  • Filter: ((f.partition_offset < partition_offset) AND ((f.message ->> 'tour_id'::text) = tour_id) AND ((f.message ->> 'forwarded_by_company_id'::text) = forwarded_by_company_id) AND ((f.message ->> 'forwarded_to_company_id'::text) = forwarded_to_company_id))
16. 0.000 0.000 ↓ 0.0

Hash (cost=27.79..27.79 rows=572 width=15) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Seq Scan on company c1 (cost=0.00..27.79 rows=572 width=15) (actual rows= loops=)

  • Filter: (NOT is_test)
18. 0.000 0.000 ↓ 0.0

Hash (cost=27.79..27.79 rows=572 width=15) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Seq Scan on company c2 (cost=0.00..27.79 rows=572 width=15) (actual rows= loops=)

  • Filter: (NOT is_test)
20. 0.000 0.000 ↓ 0.0

Hash (cost=27.79..27.79 rows=572 width=15) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Seq Scan on company c3 (cost=0.00..27.79 rows=572 width=15) (actual rows= loops=)

  • Filter: (NOT is_test)
22. 0.000 0.000 ↓ 0.0

Hash (cost=27.79..27.79 rows=572 width=15) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Seq Scan on company c4 (cost=0.00..27.79 rows=572 width=15) (actual rows= loops=)

  • Filter: (NOT is_test)