explain.depesz.com

PostgreSQL's explain analyze made readable

Result: D98d

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 10,132.546 ↑ 1.0 1 1

Limit (cost=2.43..793.13 rows=1 width=2,320) (actual time=10,132.545..10,132.546 rows=1 loops=1)

2. 9,839.600 10,132.544 ↑ 1.0 1 1

GroupAggregate (cost=2.43..793.13 rows=1 width=2,320) (actual time=10,132.544..10,132.544 rows=1 loops=1)

3. 102.678 292.944 ↓ 3,658.2 380,452 1

Nested Loop Left Join (cost=2.43..791.80 rows=104 width=2,320) (actual time=0.520..292.944 rows=380,452 loops=1)

  • Join Filter: (clients.id = appointment_client_links.client_id)
4. 0.519 134.424 ↓ 113.5 454 1

Nested Loop Left Join (cost=1.14..92.72 rows=4 width=1,361) (actual time=0.480..134.424 rows=454 loops=1)

  • Join Filter: (sp2.client_id = clients.id)
5. 1.225 132.089 ↓ 454.0 454 1

Nested Loop Left Join (cost=0.72..74.80 rows=1 width=694) (actual time=0.471..132.089 rows=454 loops=1)

  • Join Filter: (clients.id = sl.client_id)
6. 0.375 1.928 ↓ 454.0 454 1

Nested Loop Left Join (cost=0.72..16.77 rows=1 width=694) (actual time=0.036..1.928 rows=454 loops=1)

  • Join Filter: (clients.id = sub_clients.client_id)
7. 0.018 0.018 ↑ 1.0 1 1

Index Scan using clients_pkey on clients (cost=0.43..8.45 rows=1 width=467) (actual time=0.016..0.018 rows=1 loops=1)

  • Index Cond: (id = 1700736)
  • Filter: ((NOT demo_entity) AND (NOT deleted))
8. 1.535 1.535 ↓ 454.0 454 1

Index Scan using sub_clients_client_id_idx on sub_clients (cost=0.29..8.31 rows=1 width=231) (actual time=0.017..1.535 rows=454 loops=1)

  • Index Cond: (client_id = 1700736)
9. 128.936 128.936 ↓ 0.0 0 454

Seq Scan on service_packs_links sl (cost=0.00..58.02 rows=1 width=4) (actual time=0.284..0.284 rows=0 loops=454)

  • Filter: (client_id = 1700736)
  • Rows Removed by Filter: 2640
10. 1.816 1.816 ↓ 0.0 0 454

Index Scan using service_packs_client_id_idx on service_packs sp2 (cost=0.42..17.86 rows=4 width=671) (actual time=0.004..0.004 rows=0 loops=454)

  • Index Cond: (client_id = 1700736)
  • Filter: (NOT archived)
11. 30.487 55.842 ↓ 32.2 838 454

Materialize (cost=1.29..697.59 rows=26 width=963) (actual time=0.000..0.123 rows=838 loops=454)

12. 0.203 25.355 ↓ 32.2 838 1

Nested Loop Left Join (cost=1.29..697.46 rows=26 width=963) (actual time=0.035..25.355 rows=838 loops=1)

13. 0.308 14.680 ↓ 28.8 748 1

Nested Loop Left Join (cost=0.86..283.55 rows=26 width=835) (actual time=0.026..14.680 rows=748 loops=1)

14. 1.656 1.656 ↓ 28.8 748 1

Index Scan using appointment_client_links_client_id_idx on appointment_client_links (cost=0.43..63.39 rows=26 width=12) (actual time=0.011..1.656 rows=748 loops=1)

  • Index Cond: (client_id = 1700736)
15. 12.716 12.716 ↑ 1.0 1 748

Index Scan using appointments_pkey on appointments (cost=0.43..8.46 rows=1 width=831) (actual time=0.017..0.017 rows=1 loops=748)

  • Index Cond: (appointment_client_links.appointment_id = id)
  • Filter: ((NOT is_sale) AND ((status)::text = ANY ('{scheduled,sms_confirmation_sent,cancelled_by_sms,confirmed,in_progress,finished,cancelled,missed}'::text[])))
  • Rows Removed by Filter: 0
16. 10.472 10.472 ↑ 6.0 1 748

Index Scan using appointment_client_service_cost_acl_id on appointment_client_service_cost acsc (cost=0.43..15.86 rows=6 width=136) (actual time=0.013..0.014 rows=1 loops=748)

  • Index Cond: (appointment_client_link_id = appointment_client_links.id)