explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MYdE

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 10,560.708 ↓ 0.0 0 1

Nested Loop (cost=2.15..266,978.61 rows=3 width=8) (actual time=10,560.708..10,560.708 rows=0 loops=1)

  • Output: shift2_.id, appointmen0_.id
  • Buffers: shared hit=339909 read=40261 dirtied=1
  • I/O Timings: read=9084.916
2. 12.258 10,560.707 ↓ 0.0 0 1

Nested Loop (cost=1.71..266,966.99 rows=3 width=8) (actual time=10,560.707..10,560.707 rows=0 loops=1)

  • Output: appointmen0_.id, shift2_.id
  • Join Filter: ((shift2_.bdatetime <= appointmen0_.bdatetime) AND (appointmen0_.bdatetime < shift2_.edatetime))
  • Rows Removed by Join Filter: 45825
  • Buffers: shared hit=339909 read=40261 dirtied=1
  • I/O Timings: read=9084.916
3. 0.027 0.579 ↑ 1.0 5 1

Nested Loop (cost=1.27..60.10 rows=5 width=24) (actual time=0.241..0.579 rows=5 loops=1)

  • Output: timetabler1_.res_group_id, shift2_.id, shift2_.bdatetime, shift2_.edatetime
  • Buffers: shared hit=55
4. 0.055 0.422 ↑ 1.0 5 1

Nested Loop (cost=0.85..57.64 rows=5 width=28) (actual time=0.188..0.422 rows=5 loops=1)

  • Output: timetabler1_1_.id, shift2_.id, shift2_.timetable_id, shift2_.bdatetime, shift2_.edatetime
  • Buffers: shared hit=35
5. 0.217 0.217 ↑ 1.0 5 1

Index Scan using sr_shift_pk on public.sr_shift shift2_ (cost=0.43..31.39 rows=5 width=24) (actual time=0.101..0.217 rows=5 loops=1)

  • Output: shift2_.id, shift2_.bdatetime, shift2_.edatetime, shift2_.schedule_id, shift2_.time_type_id, shift2_.timetable_id, shift2_.schedule_kind_id, shift2_.aud_who, shift2_.aud_when, shift2_.aud_source, shift2_.aud_who_create, shift2_.aud_when_create, shift2_.aud_source_create
  • Index Cond: (shift2_.id = ANY ('{9046333,9046334,9046335,9046336,9046337,9046338}'::integer[]))
  • Filter: (shift2_.time_type_id = 1)
  • Rows Removed by Filter: 1
  • Buffers: shared hit=19
6. 0.150 0.150 ↑ 1.0 1 5

Index Only Scan using pk_sr_timetable on public.sr_timetable timetabler1_1_ (cost=0.42..5.24 rows=1 width=4) (actual time=0.026..0.030 rows=1 loops=5)

  • Output: timetabler1_1_.id
  • Index Cond: (timetabler1_1_.id = shift2_.timetable_id)
  • Heap Fetches: 0
  • Buffers: shared hit=16
7. 0.130 0.130 ↑ 1.0 1 5

Index Scan using pk_sr_timetable_res_group on public.sr_timetable_res_group timetabler1_ (cost=0.42..0.48 rows=1 width=8) (actual time=0.022..0.026 rows=1 loops=5)

  • Output: timetabler1_.id, timetabler1_.res_group_id, timetabler1_.aud_who, timetabler1_.aud_when, timetabler1_.aud_source, timetabler1_.aud_who_create, timetabler1_.aud_when_create, timetabler1_.aud_source_create
  • Index Cond: (timetabler1_.id = timetabler1_1_.id)
  • Buffers: shared hit=20
8. 7,438.880 10,547.870 ↓ 1,527.5 9,165 5

Index Scan using md_appointment_executor_id_idx on public.md_appointment appointmen0_ (cost=0.44..53,381.29 rows=6 width=16) (actual time=1.154..2,109.574 rows=9,165 loops=5)

  • Output: appointmen0_.id, appointmen0_.srv_rendered_id, appointmen0_.executor_id, appointmen0_.bdatetime, appointmen0_.customer_id, appointmen0_.funding_id, appointmen0_.state_id, appointmen0_.service_id, appointmen0_.cancel_reason_id, appointmen0_.care_regimen_id, appointmen0_.care_level_id, appointmen0_.referral_id, appointmen0_.source_id, appointmen0_.registrator_id, appointmen0_.registration_dt, appointmen0_.edatetime, appointmen0_.is_urgent, appointmen0_.notif_contact, appointmen0_.price_list_id, appointmen0_.message, appointmen0_.queue_state_id, appointmen0_.queue_change_dt, appointmen0_.ticket_number, appointmen0_.price, appointmen0_.init_goal_id, appointmen0_.organization_id, appointmen0_.is_house_call, appointmen0_.comment, appointmen0_.aud_who, appointmen0_.aud_when, appointmen0_.aud_source, appointmen0_.aud_who_create, appointmen0_.aud_when_create, appointmen0_.aud_source_create, appointmen0_.reject_comment, appointmen0_.reject_reason_id, appointmen0_.way_id, appointmen0_.is_cito, appointmen0_.event_id, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.cancel_dt, appointmen0_.answer_portal_code
  • Index Cond: (appointmen0_.executor_id = timetabler1_.res_group_id)
  • Filter: (appointmen0_.is_urgent AND ((SubPlan 1) = ANY ('{0,2,3,5}'::integer[])))
  • Rows Removed by Filter: 30132
  • Buffers: shared hit=339854 read=40261 dirtied=1
  • I/O Timings: read=9084.916
9.          

SubPlan (forIndex Scan)

10. 3,108.990 3,108.990 ↑ 1.0 1 50,145

Index Scan using md_appointment_pk on public.md_appointment a (cost=0.44..8.47 rows=1 width=12) (actual time=0.062..0.062 rows=1 loops=50,145)

  • Output: CASE WHEN ((a.bdatetime < ('now'::cstring)::date) AND (a.state_id = ANY ('{0,2,5}'::integer[]))) THEN 6 ELSE appointmen0_.state_id END
  • Index Cond: (a.id = appointmen0_.id)
  • Buffers: shared hit=194994 read=5856
  • I/O Timings: read=2591.784
11. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sr_ticket_pk on public.sr_ticket appointmen0_1_ (cost=0.44..3.86 rows=1 width=4) (never executed)

  • Output: appointmen0_1_.id
  • Index Cond: (appointmen0_1_.id = appointmen0_.id)
  • Heap Fetches: 0
Planning time : 11.549 ms
Execution time : 10,561.403 ms