explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PLUv

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 284,696.933 ↓ 20.0 20 1

Limit (cost=3,501.91..3,501.92 rows=1 width=1,379) (actual time=284,696.882..284,696.933 rows=20 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, ((SubPlan 1)), individual1_.id, ((((((COALESCE(individual1_.surname, ''::character varying))::text || ' '::text) || (COALESCE(individual1_.name, ''::character varying))::text) || ' '::text) || (COALESCE(individual1_.patr_name, ''::character varying))::text)), appointmen0_.notif_contact, individual1_.birth_dt, ((SubPlan 2)), resourcegr2_.id, resourcegr2_.name, appointmen0_.service_id, service20_.name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, organizati3_.id, (COALESCE(organizati3_.short_name, organizati3_.full_name)), appointmen0_.source_id, appointmen21_.name, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen10_.code, appointmen10_.name, (CASE WHEN ((referral7_.id IS NOT NULL) AND (referral7_.date_cancel IS NULL)) THEN true ELSE false END), appointmen0_.registrator_id, appointmen0_.reject_comment, ((SubPlan 4)), referralty8_.name, referral7_.order_number, referral7_.referral_date, (COALESCE(organizati9_.short_name, organizati9_.full_name)), diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, speciality15_.name, individual17_.surname, individual17_.name, individual17_.patr_name, appointmen0_.is_cito, (COALESCE(appointmen0_.is_send_message, false)), appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, (CASE WHEN ((SubPlan 5) > 0) THEN true ELSE false END), appointmen18_.name, (get_fio_by_indiv_id(appointmen0_.customer_id))
  • Buffers: shared hit=1,060,693 read=65,188
  • I/O Timings: read=274,018.250
2. 202.114 284,696.925 ↓ 20.0 20 1

Sort (cost=3,501.91..3,501.92 rows=1 width=1,379) (actual time=284,696.879..284,696.925 rows=20 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, ((SubPlan 1)), individual1_.id, ((((((COALESCE(individual1_.surname, ''::character varying))::text || ' '::text) || (COALESCE(individual1_.name, ''::character varying))::text) || ' '::text) || (COALESCE(individual1_.patr_name, ''::character varying))::text)), appointmen0_.notif_contact, individual1_.birth_dt, ((SubPlan 2)), resourcegr2_.id, resourcegr2_.name, appointmen0_.service_id, service20_.name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, organizati3_.id, (COALESCE(organizati3_.short_name, organizati3_.full_name)), appointmen0_.source_id, appointmen21_.name, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen10_.code, appointmen10_.name, (CASE WHEN ((referral7_.id IS NOT NULL) AND (referral7_.date_cancel IS NULL)) THEN true ELSE false END), appointmen0_.registrator_id, appointmen0_.reject_comment, ((SubPlan 4)), referralty8_.name, referral7_.order_number, referral7_.referral_date, (COALESCE(organizati9_.short_name, organizati9_.full_name)), diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, speciality15_.name, individual17_.surname, individual17_.name, individual17_.patr_name, appointmen0_.is_cito, (COALESCE(appointmen0_.is_send_message, false)), appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, (CASE WHEN ((SubPlan 5) > 0) THEN true ELSE false END), appointmen18_.name, (get_fio_by_indiv_id(appointmen0_.customer_id))
  • Sort Key: (get_fio_by_indiv_id(appointmen0_.customer_id))
  • Sort Method: top-N heapsort Memory: 40kB
  • Buffers: shared hit=1,060,693 read=65,188
  • I/O Timings: read=274,018.250
3. 1,767.123 284,494.811 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,966.19..3,501.90 rows=1 width=1,379) (actual time=7,076.598..284,494.811 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, (SubPlan 1), individual1_.id, (((((COALESCE(individual1_.surname, ''::character varying))::text || ' '::text) || (COALESCE(individual1_.name, ''::character varying))::text) || ' '::text) || (COALESCE(individual1_.patr_name, ''::character varying))::text), appointmen0_.notif_contact, individual1_.birth_dt, (SubPlan 2), resourcegr2_.id, resourcegr2_.name, appointmen0_.service_id, service20_.name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, organizati3_.id, COALESCE(organizati3_.short_name, organizati3_.full_name), appointmen0_.source_id, appointmen21_.name, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen10_.code, appointmen10_.name, CASE WHEN ((referral7_.id IS NOT NULL) AND (referral7_.date_cancel IS NULL)) THEN true ELSE false END, appointmen0_.registrator_id, appointmen0_.reject_comment, (SubPlan 4), referralty8_.name, referral7_.order_number, referral7_.referral_date, COALESCE(organizati9_.short_name, organizati9_.full_name), diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, speciality15_.name, individual17_.surname, individual17_.name, individual17_.patr_name, appointmen0_.is_cito, COALESCE(appointmen0_.is_send_message, false), appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, CASE WHEN ((SubPlan 5) > 0) THEN true ELSE false END, appointmen18_.name, get_fio_by_indiv_id(appointmen0_.customer_id)
  • Join Filter: (appointmen0_.source_id = appointmen21_.id)
  • Rows Removed by Join Filter: 156,618
  • Buffers: shared hit=1,060,690 read=65,188
  • I/O Timings: read=274,018.250
4. 55.797 66,003.180 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,966.19..3,436.78 rows=1 width=1,358) (actual time=6,991.603..66,003.180 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, speciality15_.name, individual17_.surname, individual17_.name, individual17_.patr_name, appointmen10_.code, appointmen10_.name, appointmen18_.name, service20_.name
  • Buffers: shared hit=641,401 read=13,397
  • I/O Timings: read=60,395.828
5. 92.414 65,668.951 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.77..3,428.64 rows=1 width=1,245) (actual time=6,983.843..65,668.951 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, speciality15_.name, individual17_.surname, individual17_.name, individual17_.patr_name, appointmen10_.code, appointmen10_.name, appointmen18_.name
  • Join Filter: (appointmen0_.cancel_base_id = appointmen18_.id)
  • Rows Removed by Join Filter: 52,206
  • Buffers: shared hit=571,807 read=13,383
  • I/O Timings: read=60,335.106
6. 94.671 65,524.331 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.77..3,410.99 rows=1 width=1,217) (actual time=6,979.259..65,524.331 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, speciality15_.name, individual17_.surname, individual17_.name, individual17_.patr_name, appointmen10_.code, appointmen10_.name
  • Join Filter: (appointmen0_.queue_state_id = appointmen10_.id)
  • Rows Removed by Join Filter: 69,571
  • Buffers: shared hit=554,406 read=13,382
  • I/O Timings: read=60,330.550
7. 58.226 65,377.454 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.77..3,409.90 rows=1 width=1,199) (actual time=6,979.245..65,377.454 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, speciality15_.name, individual17_.surname, individual17_.name, individual17_.patr_name
  • Buffers: shared hit=537,004 read=13,382
  • I/O Timings: read=60,330.550
8. 45.201 65,319.228 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.34..3,403.30 rows=1 width=1,152) (actual time=6,979.239..65,319.228 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, speciality15_.name, employee16_.individual_id
  • Buffers: shared hit=537,004 read=13,382
  • I/O Timings: read=60,330.550
9. 825.057 65,256.625 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.05..3,397.50 rows=1 width=1,152) (actual time=6,979.232..65,256.625 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, employeeto13_.employee_id, speciality15_.name
  • Join Filter: (position14_.speciality_id = speciality15_.id)
  • Rows Removed by Join Filter: 3,236,772
  • Buffers: shared hit=537,004 read=13,382
  • I/O Timings: read=60,330.550
10. 63.518 63,631.076 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.05..3,382.31 rows=1 width=1,118) (actual time=6,979.036..63,631.076 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, employeeto13_.employee_id, position14_.speciality_id
  • Buffers: shared hit=345,582 read=13,382
  • I/O Timings: read=60,330.550
11. 54.048 63,567.558 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,964.76..3,376.51 rows=1 width=1,118) (actual time=6,979.029..63,567.558 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name, medicalemp12_.id, employeeto13_.position_id, employeeto13_.employee_id
  • Buffers: shared hit=345,582 read=13,382
  • I/O Timings: read=60,330.550
12. 44.585 63,513.510 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,964.47..3,370.71 rows=1 width=1,110) (actual time=6,979.022..63,513.510 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name, medicalemp12_.id
  • Buffers: shared hit=345,582 read=13,382
  • I/O Timings: read=60,330.550
13. 49.051 63,451.523 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,964.18..3,367.64 rows=1 width=1,110) (actual time=6,979.016..63,451.523 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referral7_.recv_doctor_id, referralty8_.name, organizati9_.short_name, organizati9_.full_name, diagnosis11_.code, diagnosis11_.name
  • Buffers: shared hit=345,582 read=13,382
  • I/O Timings: read=60,330.550
14. 46.459 63,385.070 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.90..3,361.89 rows=1 width=991) (actual time=6,979.009..63,385.070 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referral7_.diagnosis_id, referral7_.recv_doctor_id, referralty8_.name, organizati9_.short_name, organizati9_.full_name
  • Buffers: shared hit=345,579 read=13,382
  • I/O Timings: read=60,330.550
15. 190.590 63,321.209 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.61..3,356.13 rows=1 width=888) (actual time=6,979.004..63,321.209 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referral7_.ref_organization_id, referral7_.diagnosis_id, referral7_.recv_doctor_id, referralty8_.name
  • Join Filter: (referral7_.referral_type_id = referralty8_.id)
  • Rows Removed by Join Filter: 539,461
  • Buffers: shared hit=345,576 read=13,382
  • I/O Timings: read=60,330.550
16. 57.709 62,939.197 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.61..3,353.44 rows=1 width=828) (actual time=6,978.949..62,939.197 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name, referral7_.id, referral7_.date_cancel, referral7_.order_number, referral7_.referral_date, referral7_.referral_type_id, referral7_.ref_organization_id, referral7_.diagnosis_id, referral7_.recv_doctor_id
  • Buffers: shared hit=310,772 read=13,382
  • I/O Timings: read=60,330.550
17. 96.593 62,864.086 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.18..3,345.10 rows=1 width=797) (actual time=6,978.938..62,864.086 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name, careregime6_.id, careregime6_.name
  • Join Filter: (appointmen0_.care_regimen_id = careregime6_.id)
  • Rows Removed by Join Filter: 121,814
  • Buffers: shared hit=310,769 read=13,381
  • I/O Timings: read=60,324.200
18. 110.914 62,697.885 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.18..3,343.94 rows=1 width=756) (actual time=6,978.920..62,697.885 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.care_regimen_id, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name, fundingsou5_.name
  • Join Filter: (appointmen0_.funding_id = fundingsou5_.id)
  • Rows Removed by Join Filter: 139,216
  • Buffers: shared hit=293,367 read=13,381
  • I/O Timings: read=60,324.200
19. 241.806 62,534.765 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.18..3,342.76 rows=1 width=731) (actual time=6,978.905..62,534.765 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.funding_id, appointmen0_.care_regimen_id, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name, caseinitgo4_.id, caseinitgo4_.name
  • Join Filter: (appointmen0_.init_goal_id = caseinitgo4_.id)
  • Rows Removed by Join Filter: 591,668
  • Buffers: shared hit=275,965 read=13,381
  • I/O Timings: read=60,324.200
20. 69.761 62,066.733 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,963.18..3,339.99 rows=1 width=656) (actual time=6,978.820..62,066.733 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.init_goal_id, appointmen0_.funding_id, appointmen0_.care_regimen_id, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name
  • Join Filter: (resourcegr2_.org_id = organizati3_1_.id)
  • Buffers: shared hit=241,161 read=13,381
  • I/O Timings: read=60,324.200
21. 83.080 61,805.550 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,962.75..3,335.68 rows=1 width=656) (actual time=6,972.901..61,805.550 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.init_goal_id, appointmen0_.funding_id, appointmen0_.care_regimen_id, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id, organizati3_.id, organizati3_.short_name, organizati3_.full_name
  • Buffers: shared hit=188,955 read=13,380
  • I/O Timings: read=60,318.389
22. 71.657 61,496.244 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,962.46..3,329.91 rows=1 width=545) (actual time=6,972.826..61,496.244 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.init_goal_id, appointmen0_.funding_id, appointmen0_.care_regimen_id, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, individual1_.id, individual1_.surname, individual1_.name, individual1_.patr_name, individual1_.birth_dt, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id
  • Buffers: shared hit=136,749 read=13,380
  • I/O Timings: read=60,318.389
23. 49.448 8,174.467 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,962.03..3,321.54 rows=1 width=486) (actual time=6,972.747..8,174.467 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.init_goal_id, appointmen0_.funding_id, appointmen0_.care_regimen_id, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id
  • Buffers: shared hit=77,168 read=3,193
  • I/O Timings: read=7,450.876
24. 92.528 7,167.909 ↓ 17,402.0 17,402 1

Merge Join (cost=1,961.59..3,316.93 rows=1 width=486) (actual time=6,960.712..7,167.909 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.init_goal_id, appointmen0_.funding_id, appointmen0_.care_regimen_id, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id, resourcegr2_.id, resourcegr2_.name, resourcegr2_.org_id
  • Merge Cond: (appointmen0_.executor_id = resourcegr2_.id)
  • Buffers: shared hit=24,008 read=2,895
  • I/O Timings: read=6,762.534
25. 67.669 6,981.268 ↓ 36.6 17,402 1

Sort (cost=1,960.52..1,961.71 rows=475 width=410) (actual time=6,952.332..6,981.268 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.executor_id, appointmen0_.init_goal_id, appointmen0_.funding_id, appointmen0_.care_regimen_id, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id
  • Sort Key: appointmen0_.executor_id
  • Sort Method: quicksort Memory: 3,538kB
  • Buffers: shared hit=14,630 read=2,895
  • I/O Timings: read=6,762.534
26. 6,913.599 6,913.599 ↓ 36.6 17,402 1

Index Scan using md_appointment_temp2_idx on public.md_appointment appointmen0_ (cost=0.69..1,939.40 rows=475 width=410) (actual time=8.155..6,913.599 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, appointmen0_.state_id, appointmen0_.customer_id, appointmen0_.notif_contact, appointmen0_.service_id, appointmen0_.source_id, appointmen0_.comment, appointmen0_.srv_rendered_id, appointmen0_.is_urgent, appointmen0_.registration_dt, appointmen0_.price, appointmen0_.registrator_id, appointmen0_.reject_comment, appointmen0_.is_cito, appointmen0_.is_send_message, appointmen0_.comment_send_message, appointmen0_.aud_source, appointmen0_.auto_return_state, appointmen0_.executor_id, appointmen0_.init_goal_id, appointmen0_.funding_id, appointmen0_.care_regimen_id, appointmen0_.referral_id, appointmen0_.queue_state_id, appointmen0_.cancel_base_id
  • Index Cond: ((get_org_of_res_group(appointmen0_.executor_id) = 36,988) AND (appointmen0_.bdatetime >= '2020-01-14 00:00:00'::timestamp without time zone) AND (appointmen0_.bdatetime <= '2020-01-20 23:59:59.999'::timestamp without time zone))
  • Filter: (NOT appointmen0_.is_house_call)
  • Buffers: shared hit=14,625 read=2,895
  • I/O Timings: read=6,762.534
27. 94.113 94.113 ↓ 3.6 26,601 1

Index Scan using sr_res_group_id_is_system_ix on public.sr_res_group resourcegr2_ (cost=0.28..1,344.72 rows=7,402 width=80) (actual time=0.082..94.113 rows=26,601 loops=1)

  • Output: resourcegr2_.id, resourcegr2_.bdate, resourcegr2_.edate, resourcegr2_.is_system, resourcegr2_.name, resourcegr2_.department_id, resourcegr2_.org_id, resourcegr2_.responsible_id, resourcegr2_.is_available_in_electronic_queue, resourcegr2_.label_id, resourcegr2_.ignore_regclinic_check, resourcegr2_.note, resourcegr2_.blocked, resourcegr2_.block_comment, resourcegr2_.template_res_group_id, resourcegr2_.aud_who, resourcegr2_.aud_when, resourcegr2_.aud_source, resourcegr2_.aud_who_create, resourcegr2_.aud_when_create, resourcegr2_.aud_source_create, resourcegr2_.emergency, resourcegr2_.ignore_districts, resourcegr2_.service_template_id
  • Buffers: shared hit=9,378
28. 957.110 957.110 ↑ 1.0 1 17,402

Index Only Scan using sr_ticket_pk on public.sr_ticket appointmen0_1_ (cost=0.44..4.60 rows=1 width=4) (actual time=0.053..0.055 rows=1 loops=17,402)

  • Output: appointmen0_1_.id
  • Index Cond: (appointmen0_1_.id = appointmen0_.id)
  • Heap Fetches: 308
  • Buffers: shared hit=53,160 read=298
  • I/O Timings: read=688.342
29. 53,250.120 53,250.120 ↑ 1.0 1 17,402

Index Scan using pim_individual_pk on public.pim_individual individual1_ (cost=0.43..8.36 rows=1 width=59) (actual time=3.054..3.060 rows=1 loops=17,402)

  • Output: individual1_.id, individual1_.birth_dt, individual1_.death_dt, individual1_.has_citizenship, individual1_.name, individual1_.patr_name, individual1_.surname, individual1_.gender_id, individual1_.nationality_id, individual1_.list_identity_doc, individual1_.list_oms_doc, individual1_.list_job_org, individual1_.list_reg_name, individual1_.list_snils, individual1_.list_uid, individual1_.aud_who, individual1_.aud_when, individual1_.aud_source, individual1_.aud_who_create, individual1_.aud_when_create, individual1_.aud_source_create, individual1_.birth_place, individual1_.age_year, individual1_.age_month, individual1_.age_day, individual1_.list_main_contact, individual1_.is_only_birth_year
  • Index Cond: (appointmen0_.customer_id = individual1_.id)
  • Buffers: shared hit=59,581 read=10,187
  • I/O Timings: read=52,867.513
30. 226.226 226.226 ↑ 1.0 1 17,402

Index Scan using pim_organization_pk on public.pim_organization organizati3_ (cost=0.29..5.76 rows=1 width=111) (actual time=0.012..0.013 rows=1 loops=17,402)

  • Output: organizati3_.id, organizati3_.short_name, organizati3_.full_name
  • Index Cond: (organizati3_.id = resourcegr2_.org_id)
  • Buffers: shared hit=52,206
31. 191.422 191.422 ↑ 1.0 1 17,402

Index Only Scan using pim_party_pk on public.pim_party organizati3_1_ (cost=0.43..4.31 rows=1 width=4) (actual time=0.010..0.011 rows=1 loops=17,402)

  • Output: organizati3_1_.id
  • Index Cond: (organizati3_1_.id = organizati3_.id)
  • Heap Fetches: 0
  • Buffers: shared hit=52,206 read=1
  • I/O Timings: read=5.811
32. 226.226 226.226 ↑ 1.0 34 17,402

Seq Scan on public.mc_case_init_goal caseinitgo4_ (cost=0.00..2.34 rows=34 width=79) (actual time=0.005..0.013 rows=34 loops=17,402)

  • Output: caseinitgo4_.id, caseinitgo4_.code, caseinitgo4_.name, caseinitgo4_.visit_type_id, caseinitgo4_.e_code, caseinitgo4_.aud_who, caseinitgo4_.aud_when, caseinitgo4_.aud_source, caseinitgo4_.aud_who_create, caseinitgo4_.aud_when_create, caseinitgo4_.aud_source_create, caseinitgo4_.from_dt, caseinitgo4_.to_dt, caseinitgo4_.billing_code
  • Buffers: shared hit=34,804
33. 52.206 52.206 ↑ 1.0 8 17,402

Seq Scan on public.fin_funding_source_type fundingsou5_ (cost=0.00..1.08 rows=8 width=33) (actual time=0.002..0.003 rows=8 loops=17,402)

  • Output: fundingsou5_.id, fundingsou5_.bdate, fundingsou5_.code, fundingsou5_.edate, fundingsou5_.name, fundingsou5_.ordern, fundingsou5_.parent_id, fundingsou5_.has_exception, fundingsou5_.e_code, fundingsou5_.is_contract_required, fundingsou5_.is_citizen, fundingsou5_.is_payer_smo, fundingsou5_.is_payer_foms, fundingsou5_.is_default, fundingsou5_.is_privileged, fundingsou5_.aud_who, fundingsou5_.aud_when, fundingsou5_.aud_source, fundingsou5_.aud_who_create, fundingsou5_.aud_when_create, fundingsou5_.aud_source_create, fundingsou5_.from_dt, fundingsou5_.to_dt, fundingsou5_.is_vmp, fundingsou5_.billing_code
  • Buffers: shared hit=17,402
34. 69.608 69.608 ↑ 1.0 7 17,402

Seq Scan on public.mc_care_regimen careregime6_ (cost=0.00..1.07 rows=7 width=45) (actual time=0.002..0.004 rows=7 loops=17,402)

  • Output: careregime6_.id, careregime6_.bdate, careregime6_.is_bed_required, careregime6_.case_mode_id, careregime6_.med_cert_name, careregime6_.code, careregime6_.edate, careregime6_.name, careregime6_.e_code, careregime6_.aud_who, careregime6_.aud_when, careregime6_.aud_source, careregime6_.aud_who_create, careregime6_.aud_when_create, careregime6_.aud_source_create, careregime6_.from_dt, careregime6_.to_dt, careregime6_.is_not_admission, careregime6_.billing_code
  • Buffers: shared hit=17,402
35. 17.402 17.402 ↓ 0.0 0 17,402

Index Scan using md_referral_pk on public.md_referral referral7_ (cost=0.43..8.33 rows=1 width=35) (actual time=0.001..0.001 rows=0 loops=17,402)

  • Output: referral7_.id, referral7_.diagnosis_comment, referral7_.is_urgent, referral7_.order_number, referral7_.referral_comment, referral7_.referral_date, referral7_.diagnosis_id, referral7_.ref_doctor_id, referral7_.funding_id, referral7_.ref_organization_id, referral7_.patient_id, referral7_.prescription_id, referral7_.recv_organization_id, referral7_.recv_doctor_id, referral7_.service_pat_id, referral7_.referral_type_id, referral7_.department_id, referral7_.note, referral7_.step_id, referral7_.service_id, referral7_.goal_id, referral7_.recv_res_group_id, referral7_.date_cancel, referral7_.cancel_reason_id, referral7_.cancel_source_id, referral7_.ref_department_id, referral7_.comment, referral7_.status_id, referral7_.cancel_reason_detail, referral7_.cancel_source_org, referral7_.cancel_source_dep, referral7_.aud_who, referral7_.aud_when, referral7_.aud_source, referral7_.aud_who_create, referral7_.aud_when_create, referral7_.aud_source_create, referral7_.clinical_form_id, referral7_.localization_id, referral7_.complication_id, referral7_.recv_regimen_id, referral7_.ref_organization_role_id, referral7_.case_id, referral7_.receiving_speciality_id, referral7_.is_operation_required, referral7_.ref_organization_code, referral7_.ref_doctor_code, referral7_.ref_status_id, referral7_.send_date, referral7_.vmp_profile_id, referral7_.vmp_kind_id, referral7_.profile_id, referral7_.bed_profile_id, referral7_.proposed_date, referral7_.disease_type_id, referral7_.is_agreement_received, referral7_.downloaded_for_pfr, referral7_.recv_organization_code, referral7_.recv_doctor_code
  • Index Cond: (appointmen0_.referral_id = referral7_.id)
  • Buffers: shared hit=3 read=1
  • I/O Timings: read=6.350
36. 191.422 191.422 ↑ 1.0 31 17,402

Seq Scan on public.md_referral_type referralty8_ (cost=0.00..2.31 rows=31 width=68) (actual time=0.004..0.011 rows=31 loops=17,402)

  • Output: referralty8_.id, referralty8_.code, referralty8_.name, referralty8_.scope_id, referralty8_.e_code, referralty8_.hsp_rsv_mark, referralty8_.aud_who, referralty8_.aud_when, referralty8_.aud_source, referralty8_.aud_who_create, referralty8_.aud_when_create, referralty8_.aud_source_create, referralty8_.from_dt, referralty8_.to_dt, referralty8_.app_code, referralty8_.is_laboratory, referralty8_.is_vk, referralty8_.billing_code
  • Buffers: shared hit=34,804
37. 17.402 17.402 ↓ 0.0 0 17,402

Index Scan using pim_organization_pk on public.pim_organization organizati9_ (cost=0.29..5.74 rows=1 width=111) (actual time=0.001..0.001 rows=0 loops=17,402)

  • Output: organizati9_.short_name, organizati9_.full_name, organizati9_.id
  • Index Cond: (referral7_.ref_organization_id = organizati9_.id)
  • Buffers: shared hit=3
38. 17.402 17.402 ↓ 0.0 0 17,402

Index Scan using md_diagnosis_pk on public.md_diagnosis diagnosis11_ (cost=0.29..5.74 rows=1 width=127) (actual time=0.001..0.001 rows=0 loops=17,402)

  • Output: diagnosis11_.id, diagnosis11_.code, diagnosis11_.name, diagnosis11_.parent_id, diagnosis11_.is_injury, diagnosis11_.level, diagnosis11_.is_leaf, diagnosis11_.e_code, diagnosis11_.oms, diagnosis11_.stomat, diagnosis11_.aud_who, diagnosis11_.aud_when, diagnosis11_.aud_source, diagnosis11_.aud_who_create, diagnosis11_.aud_when_create, diagnosis11_.aud_source_create, diagnosis11_.from_dt, diagnosis11_.to_dt, diagnosis11_.d_accounting
  • Index Cond: (referral7_.diagnosis_id = diagnosis11_.id)
  • Buffers: shared hit=3
39. 17.402 17.402 ↓ 0.0 0 17,402

Index Only Scan using md_employee_position_pk on public.md_employee_position medicalemp12_ (cost=0.29..3.06 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=17,402)

  • Output: medicalemp12_.id
  • Index Cond: (medicalemp12_.id = referral7_.recv_doctor_id)
  • Heap Fetches: 0
40. 0.000 0.000 ↓ 0.0 0 17,402

Index Scan using pim_employee_position_id_position_id_idx on public.pim_employee_position employeeto13_ (cost=0.29..5.79 rows=1 width=12) (actual time=0.000..0.000 rows=0 loops=17,402)

  • Output: employeeto13_.id, employeeto13_.dismissal_order_code, employeeto13_.start_date, employeeto13_.hiring_order_code, employeeto13_.rate, employeeto13_.end_date, employeeto13_.dismissal_reason_id, employeeto13_.employee_id, employeeto13_.employment_type_id, employeeto13_.hiring_type_id, employeeto13_.position_id, employeeto13_.position_type_id, employeeto13_.unit_id, employeeto13_.code, employeeto13_.aud_who, employeeto13_.aud_when, employeeto13_.aud_source, employeeto13_.aud_who_create, employeeto13_.aud_when_create, employeeto13_.aud_source_create, employeeto13_.pref_prescription, employeeto13_.extra_payment, employeeto13_.target_training, employeeto13_.leaving_reason_id, employeeto13_.is_chairman
  • Index Cond: (medicalemp12_.id = employeeto13_.id)
41. 0.000 0.000 ↓ 0.0 0 17,402

Index Scan using pim_position_pk on public.pim_position position14_ (cost=0.29..5.79 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=17,402)

  • Output: position14_.id, position14_.code, position14_.start_date, position14_.name, position14_.end_date, position14_.department_id, position14_.organization_id, position14_.role_id, position14_.speciality_id, position14_.rate, position14_.aud_who, position14_.aud_when, position14_.aud_source, position14_.aud_who_create, position14_.aud_when_create, position14_.aud_source_create, position14_.pref_prescription, position14_.payment_fond, position14_.staff_event1, position14_.staff_event2, position14_.note, position14_.fact_employment, position14_.external_rate, position14_.billing_code
  • Index Cond: (employeeto13_.position_id = position14_.id)
42. 800.492 800.492 ↑ 1.0 186 17,402

Seq Scan on public.pim_speciality speciality15_ (cost=0.00..12.86 rows=186 width=42) (actual time=0.003..0.046 rows=186 loops=17,402)

  • Output: speciality15_.id, speciality15_.code, speciality15_.code_regional, speciality15_.name, speciality15_.sphere_id, speciality15_.parent_id, speciality15_.education_type_id, speciality15_.e_code, speciality15_.aud_who, speciality15_.aud_when, speciality15_.aud_source, speciality15_.aud_who_create, speciality15_.aud_when_create, speciality15_.aud_source_create, speciality15_.from_dt, speciality15_.to_dt, speciality15_.billing_code
  • Buffers: shared hit=191,422
43. 17.402 17.402 ↓ 0.0 0 17,402

Index Scan using pim_employee_pk on public.pim_employee employee16_ (cost=0.29..5.79 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=17,402)

  • Output: employee16_.id, employee16_.note, employee16_.number, employee16_.photo, employee16_.callup_subject_id, employee16_.individual_id, employee16_.organization_id, employee16_.is_dismissed, employee16_.employment_dt, employee16_.dismissal_dt, employee16_.aud_who, employee16_.aud_when, employee16_.aud_source, employee16_.aud_who_create, employee16_.aud_when_create, employee16_.aud_source_create, employee16_.accreditation_id, employee16_.inherit_employee_id, employee16_.inherit_register_card
  • Index Cond: (employeeto13_.employee_id = employee16_.id)
44. 0.000 0.000 ↓ 0.0 0 17,402

Index Scan using pim_individual_pk on public.pim_individual individual17_ (cost=0.43..6.59 rows=1 width=55) (actual time=0.000..0.000 rows=0 loops=17,402)

  • Output: individual17_.id, individual17_.birth_dt, individual17_.death_dt, individual17_.has_citizenship, individual17_.name, individual17_.patr_name, individual17_.surname, individual17_.gender_id, individual17_.nationality_id, individual17_.list_identity_doc, individual17_.list_oms_doc, individual17_.list_job_org, individual17_.list_reg_name, individual17_.list_snils, individual17_.list_uid, individual17_.aud_who, individual17_.aud_when, individual17_.aud_source, individual17_.aud_who_create, individual17_.aud_when_create, individual17_.aud_source_create, individual17_.birth_place, individual17_.age_year, individual17_.age_month, individual17_.age_day, individual17_.list_main_contact, individual17_.is_only_birth_year
  • Index Cond: (employee16_.individual_id = individual17_.id)
45. 52.206 52.206 ↑ 1.0 4 17,402

Seq Scan on public.md_appointment_queue_state appointmen10_ (cost=0.00..1.04 rows=4 width=26) (actual time=0.002..0.003 rows=4 loops=17,402)

  • Output: appointmen10_.id, appointmen10_.name, appointmen10_.code, appointmen10_.e_code, appointmen10_.aud_who, appointmen10_.aud_when, appointmen10_.aud_source, appointmen10_.aud_who_create, appointmen10_.aud_when_create, appointmen10_.aud_source_create, appointmen10_.from_dt, appointmen10_.to_dt
  • Buffers: shared hit=17,402
46. 52.206 52.206 ↑ 113.3 3 17,402

Seq Scan on public.md_appointment_cancel_base appointmen18_ (cost=0.00..13.40 rows=340 width=36) (actual time=0.002..0.003 rows=3 loops=17,402)

  • Output: appointmen18_.id, appointmen18_.code, appointmen18_.name, appointmen18_.aud_who, appointmen18_.aud_when, appointmen18_.aud_source, appointmen18_.aud_who_create, appointmen18_.aud_when_create, appointmen18_.aud_source_create
  • Buffers: shared hit=17,401 read=1
  • I/O Timings: read=4.556
47. 278.432 278.432 ↑ 1.0 1 17,402

Index Scan using sr_service_pk on public.sr_service service20_ (cost=0.42..8.14 rows=1 width=117) (actual time=0.014..0.016 rows=1 loops=17,402)

  • Output: service20_.id, service20_.code, service20_.cul, service20_.is_death, service20_.duration, service20_.is_fictitious, service20_.is_independent, service20_.is_multuplicity, service20_.name, service20_.terms, service20_.org_id, service20_.category_id, service20_.duration_unit_id, service20_.prototype_id, service20_.type_id, service20_.from_dt, service20_.to_dt, service20_.is_repeated, service20_.is_inherit_protocol, service20_.is_expendable_materials, service20_.is_actual_cul, service20_.is_paraclinical, service20_.is_complex, service20_.accounting_id, service20_.is_fact, service20_.is_autocopy_diagnoses, service20_.is_stomat, service20_.srg_dif_type_id, service20_.srg_opr_kind_id, service20_.is_need_anatomic_zone, service20_.aud_who, service20_.aud_when, service20_.aud_source, service20_.aud_who_create, service20_.aud_when_create, service20_.aud_source_create, service20_.is_filling, service20_.is_extraction, service20_.is_need_close_date, service20_.is_vmp, service20_.short_name, service20_.is_blocked_for_waitlist
  • Index Cond: (service20_.id = appointmen0_.service_id)
  • Buffers: shared hit=69,594 read=14
  • I/O Timings: read=60.722
48. 87.010 87.010 ↑ 1.0 10 17,402

Seq Scan on public.md_appointment_source appointmen21_ (cost=0.00..1.10 rows=10 width=25) (actual time=0.002..0.005 rows=10 loops=17,402)

  • Output: appointmen21_.id, appointmen21_.name, appointmen21_.code, appointmen21_.e_code, appointmen21_.aud_who, appointmen21_.aud_when, appointmen21_.aud_source, appointmen21_.aud_who_create, appointmen21_.aud_when_create, appointmen21_.aud_source_create, appointmen21_.from_dt, appointmen21_.to_dt
  • Buffers: shared hit=17,402
49.          

SubPlan (for Nested Loop)

50. 87.010 76,969.046 ↑ 1.0 1 17,402

Limit (cost=0.43..17.25 rows=1 width=15) (actual time=4.423..4.423 rows=1 loops=17,402)

  • Output: ic.code
  • Buffers: shared hit=93,642 read=20,580
  • I/O Timings: read=76,051.842
51. 121.814 76,882.036 ↑ 1.0 1 17,402

Nested Loop (cost=0.43..17.25 rows=1 width=15) (actual time=4.418..4.418 rows=1 loops=17,402)

  • Output: ic.code
  • Join Filter: (ic.type_id = ct.id)
  • Rows Removed by Join Filter: 2
  • Buffers: shared hit=93,642 read=20,580
  • I/O Timings: read=76,051.842
52. 139.216 139.216 ↑ 1.0 1 17,402

Seq Scan on public.pim_code_type ct (cost=0.00..1.41 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=17,402)

  • Output: ct.id, ct.code, ct.format, ct.from_dt, ct.is_unique, ct.message_pattern, ct.name, ct.note, ct.occurrence, ct.to_dt, ct.party_type_id, ct.e_code, ct.aud_who, ct.aud_when, ct.aud_source, ct.aud_who_create, ct.aud_when_create, ct.aud_source_create
  • Filter: ((ct.code)::text = 'UID'::text)
  • Rows Removed by Filter: 7
  • Buffers: shared hit=17,402
53. 76,621.006 76,621.006 ↑ 1.0 3 17,402

Index Scan using pim_indiv_code_indiv_id_idx on public.pim_indiv_code ic (cost=0.43..15.80 rows=3 width=19) (actual time=1.917..4.403 rows=3 loops=17,402)

  • Output: ic.id, ic.code, ic.issue_dt, ic.type_id, ic.indiv_id, ic.sha256, ic.aud_who, ic.aud_when, ic.aud_source, ic.aud_who_create, ic.aud_when_create, ic.aud_source_create
  • Index Cond: (ic.indiv_id = appointmen0_.customer_id)
  • Buffers: shared hit=76,240 read=20,580
  • I/O Timings: read=76,051.842
54. 34.804 81,075.918 ↑ 1.0 1 17,402

Limit (cost=0.99..20.35 rows=1 width=4) (actual time=4.659..4.659 rows=1 loops=17,402)

  • Output: pa.addr_id
  • Buffers: shared hit=162,029 read=19,655
  • I/O Timings: read=79,827.615
55. 96.582 81,041.114 ↑ 1.0 1 17,402

Nested Loop Semi Join (cost=0.99..20.35 rows=1 width=4) (actual time=4.657..4.657 rows=1 loops=17,402)

  • Output: pa.addr_id
  • Buffers: shared hit=162,029 read=19,655
  • I/O Timings: read=79,827.615
56. 146.154 80,780.084 ↑ 1.0 1 17,402

Nested Loop (cost=0.86..20.18 rows=1 width=8) (actual time=4.606..4.642 rows=1 loops=17,402)

  • Output: pa.addr_id, pat.address_type_id
  • Buffers: shared hit=125,485 read=19,655
  • I/O Timings: read=79,827.615
57. 35,413.070 35,413.070 ↑ 1.0 1 17,402

Index Scan using pim_party_address_party_id_idx on public.pim_party_address pa (cost=0.43..11.72 rows=1 width=8) (actual time=2.034..2.035 rows=1 loops=17,402)

  • Output: pa.id, pa.from_date, pa.note, pa.text_addr, pa.to_date, pa.is_valid, pa.addr_id, pa.party_id, pa.register_type_id, pa.aud_who, pa.aud_when, pa.aud_source, pa.aud_who_create, pa.aud_when_create, pa.aud_source_create
  • Index Cond: (pa.party_id = appointmen0_.customer_id)
  • Filter: pa.is_valid
  • Rows Removed by Filter: 0
  • Buffers: shared hit=65,740 read=9,720
  • I/O Timings: read=34,981.708
58. 45,220.860 45,220.860 ↑ 1.0 1 17,326

Index Scan using pim_party_addr_to_addr_type_party_address_id_idx on public.pim_party_addr_to_addr_type pat (cost=0.43..8.45 rows=1 width=8) (actual time=2.575..2.610 rows=1 loops=17,326)

  • Output: pat.id, pat.address_type_id, pat.party_address_id, pat.aud_who, pat.aud_when, pat.aud_source, pat.aud_who_create, pat.aud_when_create, pat.aud_source_create
  • Index Cond: (pat.party_address_id = pa.id)
  • Buffers: shared hit=59,745 read=9,935
  • I/O Timings: read=44,845.907
59. 164.448 164.448 ↑ 1.0 1 18,272

Index Scan using pim_address_type_pk on public.pim_address_type t (cost=0.13..0.15 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=18,272)

  • Output: t.id, t.code, t.name, t.note, t.party_type_id, t.e_code, t.aud_who, t.aud_when, t.aud_source, t.aud_who_create, t.aud_when_create, t.aud_source_create, t.from_dt, t.to_dt, t.is_unique, t.is_singular
  • Index Cond: (t.id = pat.address_type_id)
  • Filter: ((t.code)::text = ANY ('{ACTUAL,REGISTER}'::text[]))
  • Rows Removed by Filter: 0
  • Buffers: shared hit=36,544
60. 69.608 58,314.102 ↑ 1.0 1 17,402

Result (cost=16.47..16.48 rows=1 width=0) (actual time=3.351..3.351 rows=1 loops=17,402)

  • Output: $6
  • Buffers: shared hit=59,180 read=11,556
  • I/O Timings: read=57,742.965
61.          

Initplan (for Result)

62. 34.804 58,244.494 ↑ 1.0 1 17,402

Limit (cost=0.43..16.47 rows=1 width=2) (actual time=3.347..3.347 rows=1 loops=17,402)

  • Output: ((patientreg22_.number_attach)::text)
  • Buffers: shared hit=59,180 read=11,556
  • I/O Timings: read=57,742.965
63. 58,209.690 58,209.690 ↑ 1.0 1 17,402

Index Scan Backward using pci_patient_reg_patient_id_number_attach_ix on public.pci_patient_reg patientreg22_ (cost=0.43..16.47 rows=1 width=2) (actual time=3.345..3.345 rows=1 loops=17,402)

  • Output: patientreg22_.number_attach
  • Index Cond: ((patientreg22_.patient_id = individual1_.id) AND ((patientreg22_.number_attach)::text IS NOT NULL))
  • Filter: (patientreg22_.clinic_id = resourcegr2_.org_id)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=59,180 read=11,556
  • I/O Timings: read=57,742.965
64. 121.814 278.432 ↑ 1.0 1 17,402

Aggregate (cost=9.54..9.55 rows=1 width=4) (actual time=0.016..0.016 rows=1 loops=17,402)

  • Output: count(quarantine23_.id)
  • Buffers: shared hit=17,402
65. 52.206 156.618 ↓ 0.0 0 17,402

Bitmap Heap Scan on public.mc_quarantine_info quarantine23_ (cost=4.16..9.53 rows=1 width=4) (actual time=0.009..0.009 rows=0 loops=17,402)

  • Output: quarantine23_.id, quarantine23_.patient_id, quarantine23_.open_reason_id, quarantine23_.close_reason_id, quarantine23_.approve_date, quarantine23_.begin_dt, quarantine23_.end_dt, quarantine23_.is_deleted, quarantine23_.aud_who, quarantine23_.aud_when, quarantine23_.aud_source, quarantine23_.aud_who_create, quarantine23_.aud_when_create, quarantine23_.aud_source_create
  • Recheck Cond: (quarantine23_.patient_id = individual1_.id)
  • Filter: (((quarantine23_.is_deleted IS NULL) OR (NOT quarantine23_.is_deleted)) AND ((quarantine23_.begin_dt IS NOT NULL) OR (quarantine23_.end_dt IS NOT NULL)) AND (date(appointmen0_.bdatetime) >= COALESCE(quarantine23_.begin_dt, date(appointmen0_.bdatetime))) AND (date(appointmen0_.bdatetime) <= COALESCE(quarantine23_.end_dt, date(appointmen0_.bdatetime))))
  • Buffers: shared hit=17,402
66. 104.412 104.412 ↓ 0.0 0 17,402

Bitmap Index Scan on mc_quarantine_info_patient_id_idx (cost=0.00..4.16 rows=2 width=0) (actual time=0.006..0.006 rows=0 loops=17,402)

  • Index Cond: (quarantine23_.patient_id = individual1_.id)
  • Buffers: shared hit=17,402
Planning time : 123.953 ms
Execution time : 284,699.616 ms