explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GkAp

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 14,605.703 ↓ 20.0 20 1

Limit (cost=3,500.69..3,500.69 rows=1 width=1,358) (actual time=14,605.694..14,605.703 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, 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,106,453 read=2,018
  • I/O Timings: read=8,692.506
2. 95.317 14,605.699 ↓ 20.0 20 1

Sort (cost=3,500.69..3,500.69 rows=1 width=1,358) (actual time=14,605.691..14,605.699 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, 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: 35kB
  • Buffers: shared hit=1,106,453 read=2,018
  • I/O Timings: read=8,692.506
3. 759.818 14,510.382 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,966.19..3,500.68 rows=1 width=1,358) (actual time=86.407..14,510.382 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, 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,106,453 read=2,018
  • I/O Timings: read=8,692.506
4. 57.339 12,253.992 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.77..3,428.64 rows=1 width=1,245) (actual time=85.800..12,253.992 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=583,167 read=2,018
  • I/O Timings: read=8,692.506
5. 63.750 12,161.849 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.77..3,410.99 rows=1 width=1,217) (actual time=85.789..12,161.849 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=565,765 read=2,018
  • I/O Timings: read=8,692.506
6. 34.317 12,063.295 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.77..3,409.90 rows=1 width=1,199) (actual time=85.777..12,063.295 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=548,363 read=2,018
  • I/O Timings: read=8,692.506
7. 39.571 12,028.978 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.34..3,403.30 rows=1 width=1,152) (actual time=85.772..12,028.978 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=548,363 read=2,018
  • I/O Timings: read=8,692.506
8. 687.066 11,989.407 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.05..3,397.50 rows=1 width=1,152) (actual time=85.766..11,989.407 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=548,363 read=2,018
  • I/O Timings: read=8,692.506
9. 33.118 10,641.065 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,965.05..3,382.31 rows=1 width=1,118) (actual time=85.659..10,641.065 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=356,941 read=2,018
  • I/O Timings: read=8,692.506
10. 33.362 10,607.947 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,964.76..3,376.51 rows=1 width=1,118) (actual time=85.654..10,607.947 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=356,941 read=2,018
  • I/O Timings: read=8,692.506
11. 33.497 10,574.585 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,964.47..3,370.71 rows=1 width=1,110) (actual time=85.650..10,574.585 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=356,941 read=2,018
  • I/O Timings: read=8,692.506
12. 33.954 10,541.088 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,964.18..3,367.64 rows=1 width=1,110) (actual time=85.646..10,541.088 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=356,941 read=2,018
  • I/O Timings: read=8,692.506
13. 35.409 10,507.134 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.90..3,361.89 rows=1 width=991) (actual time=85.640..10,507.134 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=356,938 read=2,018
  • I/O Timings: read=8,692.506
14. 152.547 10,471.725 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.61..3,356.13 rows=1 width=888) (actual time=85.635..10,471.725 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=356,935 read=2,018
  • I/O Timings: read=8,692.506
15. 25.040 10,179.962 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.61..3,353.44 rows=1 width=828) (actual time=85.609..10,179.962 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=322,131 read=2,018
  • I/O Timings: read=8,692.506
16. 63.000 10,137.520 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.18..3,345.10 rows=1 width=797) (actual time=85.604..10,137.520 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=322,128 read=2,017
  • I/O Timings: read=8,687.390
17. 69.490 10,022.314 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.18..3,343.94 rows=1 width=756) (actual time=85.590..10,022.314 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=304,726 read=2,017
  • I/O Timings: read=8,687.390
18. 174.052 9,900.618 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,963.18..3,342.76 rows=1 width=731) (actual time=85.576..9,900.618 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=287,324 read=2,017
  • I/O Timings: read=8,687.390
19. 30.585 9,569.948 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,963.18..3,339.99 rows=1 width=656) (actual time=85.533..9,569.948 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=252,520 read=2,017
  • I/O Timings: read=8,687.390
20. 43.912 9,434.951 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,962.75..3,335.68 rows=1 width=656) (actual time=85.506..9,434.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, 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=200,313 read=2,017
  • I/O Timings: read=8,687.390
21. 30.432 9,286.627 ↓ 17,402.0 17,402 1

Nested Loop Left Join (cost=1,962.46..3,329.91 rows=1 width=545) (actual time=85.491..9,286.627 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=148,107 read=2,017
  • I/O Timings: read=8,687.390
22. 28.384 363.773 ↓ 17,402.0 17,402 1

Nested Loop (cost=1,962.03..3,321.54 rows=1 width=486) (actual time=85.471..363.773 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
23. 47.177 178.771 ↓ 17,402.0 17,402 1

Merge Join (cost=1,961.59..3,316.93 rows=1 width=486) (actual time=85.443..178.771 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
24. 40.489 96.825 ↓ 36.6 17,402 1

Sort (cost=1,960.52..1,961.71 rows=475 width=410) (actual time=82.669..96.825 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
25. 56.336 56.336 ↓ 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.053..56.336 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
26. 34.769 34.769 ↓ 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.034..34.769 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
27. 156.618 156.618 ↑ 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.008..0.009 rows=1 loops=17,402)

  • Output: appointmen0_1_.id
  • Index Cond: (appointmen0_1_.id = appointmen0_.id)
  • Heap Fetches: 308
  • Buffers: shared hit=53,458
28. 8,892.422 8,892.422 ↑ 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.510..0.511 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=67,751 read=2,017
  • I/O Timings: read=8,687.390
29. 104.412 104.412 ↑ 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.006..0.006 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
30. 104.412 104.412 ↑ 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.005..0.006 rows=1 loops=17,402)

  • Output: organizati3_1_.id
  • Index Cond: (organizati3_1_.id = organizati3_.id)
  • Heap Fetches: 0
  • Buffers: shared hit=52,207
31. 156.618 156.618 ↑ 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.003..0.009 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
32. 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.001..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
33. 52.206 52.206 ↑ 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.003 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
34. 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=5.116
35. 139.216 139.216 ↑ 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.003..0.008 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
36. 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
37. 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
38. 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
39. 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)
40. 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)
41. 661.276 661.276 ↑ 1.0 186 17,402

Seq Scan on public.pim_speciality speciality15_ (cost=0.00..12.86 rows=186 width=42) (actual time=0.002..0.038 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
42. 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)
43. 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)
44. 34.804 34.804 ↑ 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.002 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
45. 34.804 34.804 ↑ 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.002 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
46. 121.814 121.814 ↑ 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.006..0.007 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
47.          

SubPlan (for Nested Loop)

48. 69.608 452.452 ↑ 1.0 1 17,402

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

  • Output: ic.code
  • Buffers: shared hit=114,222
49. 34.804 382.844 ↑ 1.0 1 17,402

Nested Loop (cost=0.43..17.25 rows=1 width=15) (actual time=0.022..0.022 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
50. 87.010 87.010 ↑ 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.005..0.005 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
51. 261.030 261.030 ↑ 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.011..0.015 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
52. 17.402 539.462 ↑ 1.0 1 17,402

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

  • Output: pa.addr_id
  • Buffers: shared hit=181,684
53. 31.324 522.060 ↑ 1.0 1 17,402

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

  • Output: pa.addr_id
  • Buffers: shared hit=181,684
54. 52.966 417.648 ↑ 1.0 1 17,402

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

  • Output: pa.addr_id, pat.address_type_id
  • Buffers: shared hit=145,140
55. 191.422 191.422 ↑ 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.011..0.011 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
56. 173.260 173.260 ↑ 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.010..0.010 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
57. 73.088 73.088 ↑ 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.004..0.004 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
58. 17.402 261.030 ↑ 1.0 1 17,402

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

  • Output: $6
  • Buffers: shared hit=70,736
59.          

Initplan (for Result)

60. 34.804 243.628 ↑ 1.0 1 17,402

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

  • Output: ((patientreg22_.number_attach)::text)
  • Buffers: shared hit=70,736
61. 208.824 208.824 ↑ 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.012..0.012 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
62. 69.608 121.814 ↑ 1.0 1 17,402

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

  • Output: count(quarantine23_.id)
  • Buffers: shared hit=17,402
63. 17.402 52.206 ↓ 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.003..0.003 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
64. 34.804 34.804 ↓ 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.002..0.002 rows=0 loops=17,402)

  • Index Cond: (quarantine23_.patient_id = individual1_.id)
  • Buffers: shared hit=17,402
Planning time : 50.467 ms
Execution time : 14,608.705 ms