explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VzP

Settings
# exclusive inclusive rows x rows loops node
1. 0.164 305.445 ↑ 2.0 1 1

GroupAggregate (cost=80,213.95..80,214.67 rows=2 width=68) (actual time=305.445..305.445 rows=1 loops=1)

  • Group Key: clients.name
2. 0.045 305.281 ↑ 10.0 3 1

Sort (cost=80,213.95..80,214.03 rows=30 width=150) (actual time=305.281..305.281 rows=3 loops=1)

  • Sort Key: clients.name
  • Sort Method: quicksort Memory: 27kB
3. 0.063 305.236 ↑ 10.0 3 1

Hash Join (cost=66,620.24..80,213.22 rows=30 width=150) (actual time=305.062..305.236 rows=3 loops=1)

  • Hash Cond: (service_desk_tickets.client_id = clients.id)
4. 0.346 296.575 ↑ 47,176.8 5 1

GroupAggregate (cost=66,047.45..76,662.23 rows=235,884 width=162) (actual time=296.335..296.575 rows=5 loops=1)

  • Group Key: service_desk_tickets.title, service_desk_tickets.ticket_number, service_desk_tickets.client_id, clients_1.name
5. 0.075 296.229 ↑ 47,176.8 5 1

Sort (cost=66,047.45..66,637.16 rows=235,884 width=154) (actual time=296.227..296.229 rows=5 loops=1)

  • Sort Key: service_desk_tickets.title, service_desk_tickets.ticket_number, service_desk_tickets.client_id, clients_1.name
  • Sort Method: quicksort Memory: 27kB
6. 0.107 296.154 ↑ 47,176.8 5 1

Hash Join (cost=842.30..26,450.99 rows=235,884 width=154) (actual time=296.132..296.154 rows=5 loops=1)

  • Hash Cond: (service_desk_tickets.client_id = clients_1.id)
7. 40.615 289.160 ↑ 47,176.8 5 1

Hash Left Join (cost=110.53..25,099.86 rows=235,884 width=134) (actual time=289.139..289.160 rows=5 loops=1)

  • Hash Cond: (service_desk_tickets.id = ticket_internal_costs.ticket_id)
  • Filter: (((service_desk_tickets.organization_id = 2964) AND (ticket_internal_costs.qtd_internal_costs IS NOT NULL)) OR (ticket_extra_values.qtd_extra_values IS NOT NULL))
  • Rows Removed by Filter: 237106
8. 54.995 248.148 ↓ 1.0 237,111 1

Hash Left Join (cost=101.15..24,468.15 rows=237,069 width=94) (actual time=1.535..248.148 rows=237,111 loops=1)

  • Hash Cond: (service_desk_tickets.id = ticket_extra_values.ticket_id)
9. 191.739 191.739 ↓ 1.0 237,111 1

Seq Scan on service_desk_tickets (cost=0.00..23,744.69 rows=237,069 width=46) (actual time=0.085..191.739 rows=237,111 loops=1)

  • Filter: (ticket_number IS NOT NULL)
10. 0.010 1.414 ↓ 4.0 4 1

Hash (cost=101.13..101.13 rows=1 width=52) (actual time=1.414..1.414 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
11. 0.004 1.404 ↓ 4.0 4 1

Subquery Scan on ticket_extra_values (cost=101.09..101.13 rows=1 width=52) (actual time=1.271..1.404 rows=4 loops=1)

12. 0.374 1.400 ↓ 4.0 4 1

GroupAggregate (cost=101.09..101.12 rows=1 width=52) (actual time=1.269..1.400 rows=4 loops=1)

  • Group Key: service_desk_ticket_extra_values.ticket_id
13. 0.032 1.026 ↓ 7.0 7 1

Sort (cost=101.09..101.09 rows=1 width=63) (actual time=1.023..1.026 rows=7 loops=1)

  • Sort Key: service_desk_ticket_extra_values.ticket_id
  • Sort Method: quicksort Memory: 25kB
14. 0.018 0.994 ↓ 7.0 7 1

Nested Loop (cost=0.28..101.08 rows=1 width=63) (actual time=0.944..0.994 rows=7 loops=1)

15. 0.906 0.906 ↓ 7.0 7 1

Seq Scan on service_desk_ticket_extra_values (cost=0.00..92.78 rows=1 width=47) (actual time=0.899..0.906 rows=7 loops=1)

  • Filter: ((id IS NOT NULL) AND (date >= '2019-08-01'::date) AND (date <= '2019-08-13'::date))
  • Rows Removed by Filter: 3209
16. 0.070 0.070 ↑ 1.0 1 7

Index Scan using users_pkey on users (cost=0.28..8.30 rows=1 width=24) (actual time=0.010..0.010 rows=1 loops=7)

  • Index Cond: (id = service_desk_ticket_extra_values.user_id)
17. 0.006 0.397 ↓ 4.0 4 1

Hash (cost=9.37..9.37 rows=1 width=52) (actual time=0.397..0.397 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
18. 0.004 0.391 ↓ 4.0 4 1

Subquery Scan on ticket_internal_costs (cost=9.33..9.37 rows=1 width=52) (actual time=0.283..0.391 rows=4 loops=1)

19. 0.298 0.387 ↓ 4.0 4 1

GroupAggregate (cost=9.33..9.36 rows=1 width=52) (actual time=0.281..0.387 rows=4 loops=1)

  • Group Key: service_desk_ticket_internal_costs.ticket_id
20. 0.017 0.089 ↓ 7.0 7 1

Sort (cost=9.33..9.33 rows=1 width=46) (actual time=0.087..0.089 rows=7 loops=1)

  • Sort Key: service_desk_ticket_internal_costs.ticket_id
  • Sort Method: quicksort Memory: 25kB
21. 0.011 0.072 ↓ 7.0 7 1

Nested Loop (cost=0.28..9.32 rows=1 width=46) (actual time=0.037..0.072 rows=7 loops=1)

22. 0.019 0.019 ↓ 7.0 7 1

Seq Scan on service_desk_ticket_internal_costs (cost=0.00..1.01 rows=1 width=30) (actual time=0.015..0.019 rows=7 loops=1)

  • Filter: ((id IS NOT NULL) AND (date >= '2019-08-01'::date) AND (date <= '2019-08-13'::date))
23. 0.042 0.042 ↑ 1.0 1 7

Index Scan using users_pkey on users users_1 (cost=0.28..8.30 rows=1 width=24) (actual time=0.006..0.006 rows=1 loops=7)

  • Index Cond: (id = service_desk_ticket_internal_costs.user_id)
24. 3.879 6.887 ↑ 1.0 15,870 1

Hash (cost=533.01..533.01 rows=15,901 width=24) (actual time=6.887..6.887 rows=15,870 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 1023kB
25. 3.008 3.008 ↑ 1.0 15,870 1

Seq Scan on clients clients_1 (cost=0.00..533.01 rows=15,901 width=24) (actual time=0.007..3.008 rows=15,870 loops=1)

26. 0.046 8.598 ↓ 2.5 5 1

Hash (cost=572.76..572.76 rows=2 width=24) (actual time=8.598..8.598 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
27. 8.552 8.552 ↓ 2.5 5 1

Seq Scan on clients (cost=0.00..572.76 rows=2 width=24) (actual time=8.544..8.552 rows=5 loops=1)

  • Filter: (organization_id = 2964)
  • Rows Removed by Filter: 15865
Planning time : 13.257 ms
Execution time : 306.455 ms