explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KOV

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 3,870.956 ↓ 20.0 20 1

Limit (cost=3,516.00..3,516.00 rows=1 width=1,408) (actual time=3,870.949..3,870.956 rows=20 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, ((SubPlan 1)), appointmen19_.name, appointmen0_.state_id, ((SubPlan 2)), 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 3)), 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 5)), 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 6) > 0) THEN true ELSE false END), appointmen18_.name, (get_fio_by_indiv_id(appointmen0_.customer_id))
  • Buffers: shared hit=1,387,165
2. 56.006 3,870.950 ↓ 20.0 20 1

Sort (cost=3,516.00..3,516.00 rows=1 width=1,408) (actual time=3,870.947..3,870.950 rows=20 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, ((SubPlan 1)), appointmen19_.name, appointmen0_.state_id, ((SubPlan 2)), 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 3)), 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 5)), 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 6) > 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: 42kB
  • Buffers: shared hit=1,387,165
3. 471.493 3,814.944 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,967.37..3,515.99 rows=1 width=1,408) (actual time=68.732..3,814.944 rows=17,402 loops=1)

  • Output: appointmen0_.id, appointmen0_.ticket_number, appointmen0_.bdatetime, appointmen0_.edatetime, (SubPlan 1), appointmen19_.name, appointmen0_.state_id, (SubPlan 2), 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 3), 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 5), 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 6) > 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,387,165
4. 20.883 2,438.547 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,967.37..3,442.28 rows=1 width=1,387) (actual time=68.150..2,438.547 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, appointmen19_.name, service20_.name
  • Buffers: shared hit=828,988
5. 66.718 2,348.056 ↓ 17,402.0 17,402 1

Hash Join (cost=1,966.95..3,434.13 rows=1 width=1,274) (actual time=68.134..2,348.056 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, appointmen19_.name
  • Hash Cond: ((SubPlan 7) = appointmen19_.id)
  • Buffers: shared hit=759,380
6. 34.929 2,072.496 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.77..3,428.64 rows=1 width=1,245) (actual time=68.053..2,072.496 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=585,185
7. 38.120 2,020.165 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.77..3,410.99 rows=1 width=1,217) (actual time=68.043..2,020.165 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=567,783
8. 19.738 1,964.643 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.77..3,409.90 rows=1 width=1,199) (actual time=68.033..1,964.643 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=550,381
9. 20.131 1,944.905 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.34..3,403.30 rows=1 width=1,152) (actual time=68.029..1,944.905 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=550,381
10. 412.299 1,924.774 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.05..3,397.50 rows=1 width=1,152) (actual time=68.024..1,924.774 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=550,381
11. 19.112 1,129.631 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.05..3,382.31 rows=1 width=1,118) (actual time=67.932..1,129.631 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=358,959
12. 19.932 1,110.519 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,964.76..3,376.51 rows=1 width=1,118) (actual time=67.928..1,110.519 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=358,959
13. 19.139 1,090.587 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,964.47..3,370.71 rows=1 width=1,110) (actual time=67.924..1,090.587 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=358,959
14. 19.882 1,071.448 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,964.18..3,367.64 rows=1 width=1,110) (actual time=67.920..1,071.448 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=358,959
15. 20.340 1,051.566 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.90..3,361.89 rows=1 width=991) (actual time=67.916..1,051.566 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=358,956
16. 83.917 1,031.226 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.61..3,356.13 rows=1 width=888) (actual time=67.911..1,031.226 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=358,953
17. 21.075 860.299 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.61..3,353.44 rows=1 width=828) (actual time=67.881..860.299 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=324,149
18. 48.416 839.224 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.18..3,345.10 rows=1 width=797) (actual time=67.877..839.224 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=324,145
19. 34.730 773.406 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.18..3,343.94 rows=1 width=756) (actual time=67.865..773.406 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=306,743
20. 105.279 703.872 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.18..3,342.76 rows=1 width=731) (actual time=67.853..703.872 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=289,341
21. 25.363 511.583 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,963.18..3,339.99 rows=1 width=656) (actual time=67.819..511.583 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=254,537
22. 24.203 434.014 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,962.75..3,335.68 rows=1 width=656) (actual time=67.793..434.014 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=202,330
23. 25.571 357.605 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,962.46..3,329.91 rows=1 width=545) (actual time=67.773..357.605 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=150,124
24. 20.954 227.622 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,962.03..3,321.54 rows=1 width=486) (actual time=67.756..227.622 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=80,356
25. 24.575 119.658 ↓ 17,402.0 17,402 1

Merge Join (cost=1,961.59..3,316.93 rows=1 width=486) (actual time=67.730..119.658 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=26,898
26. 28.916 73.680 ↓ 36.6 17,402 1

Sort (cost=1,960.52..1,961.71 rows=475 width=410) (actual time=65.351..73.680 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=17,520
27. 44.764 44.764 ↓ 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=0.026..44.764 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=17,520
28. 21.403 21.403 ↓ 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.028..21.403 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
29. 87.010 87.010 ↑ 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.005..0.005 rows=1 loops=17,402)

  • Output: appointmen0_1_.id
  • Index Cond: (appointmen0_1_.id = appointmen0_.id)
  • Heap Fetches: 308
  • Buffers: shared hit=53,458
30. 104.412 104.412 ↑ 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=0.006..0.006 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=69,768
31. 52.206 52.206 ↑ 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.003..0.003 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
32. 52.206 52.206 ↑ 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.003..0.003 rows=1 loops=17,402)

  • Output: organizati3_1_.id
  • Index Cond: (organizati3_1_.id = organizati3_.id)
  • Heap Fetches: 0
  • Buffers: shared hit=52,207
33. 87.010 87.010 ↑ 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.001..0.005 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
34. 34.804 34.804 ↑ 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.001..0.002 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
35. 17.402 17.402 ↑ 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.001..0.001 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
36. 0.000 0.000 ↓ 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.000..0.000 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=4
37. 87.010 87.010 ↑ 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.001..0.005 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
38. 0.000 0.000 ↓ 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.000..0.000 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
39. 0.000 0.000 ↓ 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.000..0.000 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
40. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=17,402)

  • Output: medicalemp12_.id
  • Index Cond: (medicalemp12_.id = referral7_.recv_doctor_id)
  • Heap Fetches: 0
41. 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)
42. 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)
43. 382.844 382.844 ↑ 1.0 186 17,402

Seq Scan on public.pim_speciality speciality15_ (cost=0.00..12.86 rows=186 width=42) (actual time=0.001..0.022 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
44. 0.000 0.000 ↓ 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.000..0.000 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)
45. 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)
46. 17.402 17.402 ↑ 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.001..0.001 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
47. 17.402 17.402 ↑ 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.001..0.001 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,402
48. 0.009 0.018 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=33) (actual time=0.018..0.018 rows=8 loops=1)

  • Output: appointmen19_.name, appointmen19_.id
  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
49. 0.009 0.009 ↑ 1.0 8 1

Seq Scan on public.md_appointment_state appointmen19_ (cost=0.00..1.08 rows=8 width=33) (actual time=0.006..0.009 rows=8 loops=1)

  • Output: appointmen19_.name, appointmen19_.id
  • Buffers: shared hit=1
50.          

SubPlan (for Hash Join)

51. 208.824 208.824 ↑ 1.0 1 34,804

Index Scan using md_appointment_pk on public.md_appointment a_1 (cost=0.56..8.59 rows=1 width=12) (actual time=0.006..0.006 rows=1 loops=34,804)

  • Output: CASE WHEN ((a_1.bdatetime < ('now'::cstring)::date) AND (a_1.state_id = ANY ('{0,2,5}'::integer[]))) THEN 6 ELSE appointmen0_.state_id END
  • Index Cond: (a_1.id = appointmen0_.id)
  • Buffers: shared hit=174,194
52. 69.608 69.608 ↑ 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.003..0.004 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,608
53. 34.804 34.804 ↑ 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.001..0.002 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
54.          

SubPlan (for Nested Loop)

55. 69.608 69.608 ↑ 1.0 1 17,402

Index Scan using md_appointment_pk on public.md_appointment a (cost=0.56..8.59 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=17,402)

  • 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=87,097
56. 34.804 261.030 ↑ 1.0 1 17,402

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

  • Output: ic.code
  • Buffers: shared hit=114,222
57. 17.402 226.226 ↑ 1.0 1 17,402

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

  • Output: ic.code
  • Join Filter: (ic.type_id = ct.id)
  • Rows Removed by Join Filter: 2
  • Buffers: shared hit=114,222
58. 52.206 52.206 ↑ 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.003..0.003 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
59. 156.618 156.618 ↑ 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=0.006..0.009 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=96,820
60. 17.402 313.236 ↑ 1.0 1 17,402

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

  • Output: pa.addr_id
  • Buffers: shared hit=181,684
61. 15.662 295.834 ↑ 1.0 1 17,402

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

  • Output: pa.addr_id
  • Buffers: shared hit=181,684
62. 17.858 243.628 ↑ 1.0 1 17,402

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

  • Output: pa.addr_id, pat.address_type_id
  • Buffers: shared hit=145,140
63. 121.814 121.814 ↑ 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=0.007..0.007 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=75,460
64. 103.956 103.956 ↑ 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=0.006..0.006 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=69,680
65. 36.544 36.544 ↑ 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.002..0.002 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
66. 17.402 156.618 ↑ 1.0 1 17,402

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

  • Output: $8
  • Buffers: shared hit=70,736
67.          

Initplan (for Result)

68. 17.402 139.216 ↑ 1.0 1 17,402

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

  • Output: ((patientreg22_.number_attach)::text)
  • Buffers: shared hit=70,736
69. 121.814 121.814 ↑ 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=0.007..0.007 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=70,736
70. 34.804 69.608 ↑ 1.0 1 17,402

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

  • Output: count(quarantine23_.id)
  • Buffers: shared hit=17,402
71. 17.402 34.804 ↓ 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.002..0.002 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
72. 17.402 17.402 ↓ 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.001..0.001 rows=0 loops=17,402)

  • Index Cond: (quarantine23_.patient_id = individual1_.id)
  • Buffers: shared hit=17,402
Planning time : 35.952 ms
Execution time : 3,872.283 ms