explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DL3i

Settings
# exclusive inclusive rows x rows loops node
1. 0.028 10.449 ↑ 50.0 2 1

Sort (cost=1,869.32..1,869.57 rows=100 width=209) (actual time=10.448..10.449 rows=2 loops=1)

  • Output: deduction.deduction_id, deduction.deduction_number, deduction.company_id, company.company_name, company.company_number, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction_balance_materialized.deduction_amount_remaining, deduction.deduction_active_state, ((CASE WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'NONE'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'OPEN'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'PARTIAL'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'MATCHED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'BALANCED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'PARTIAL'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'PARTIAL'::enum.deduction_balance_allowed_state)) THEN 'MATCHED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'PARTIAL'::enum.deduction_balance_allowed_state)) THEN 'BALANCED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'PARTIAL'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'PARTIAL'::enum.deduction_balance_allowed_state)) THEN 'MATCHED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'PARTIAL'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'MATCHED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'CLEARED'::enum.deduction_balance_allowed_state)) THEN 'CLEARED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'PARTIAL'::enum.deduction_balance_allowed_state)) THEN 'COMPLETE'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'COMPLETE'::text ELSE 'INVALID'::text END)::enum.deduction_state), ((CASE WHEN (deduction_balance_materialized_3.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_3.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_3.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_3.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_3.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state), ((CASE WHEN (deduction_balance_materialized_4.deduction_amount_remaining = deduction_2.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_4.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_4.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state), (COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state)), deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, (string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text)), ((COALESCE(deduction.deduction_date_closed, (now())::date) - deduction.deduction_date_created))
  • Sort Key: deduction.deduction_number
  • Sort Method: quicksort Memory: 26kB
  • Buffers: shared hit=197 read=46
2. 0.763 10.421 ↑ 50.0 2 1

Nested Loop (cost=838.08..1,866.00 rows=100 width=209) (actual time=9.111..10.421 rows=2 loops=1)

  • Output: deduction.deduction_id, deduction.deduction_number, deduction.company_id, company.company_name, company.company_number, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction_balance_materialized.deduction_amount_remaining, deduction.deduction_active_state, (CASE WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'NONE'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'OPEN'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'PARTIAL'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'MATCHED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'BALANCED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'PARTIAL'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'PARTIAL'::enum.deduction_balance_allowed_state)) THEN 'MATCHED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'UNRELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'PARTIAL'::enum.deduction_balance_allowed_state)) THEN 'BALANCED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'PARTIAL'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'PARTIAL'::enum.deduction_balance_allowed_state)) THEN 'MATCHED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'PARTIAL'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'MATCHED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'CLEARED'::enum.deduction_balance_allowed_state)) THEN 'CLEARED'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'PARTIAL'::enum.deduction_balance_allowed_state)) THEN 'COMPLETE'::text WHEN ((COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state) = 'RELIABLE'::enum.deduction_reliability_state) AND ((CASE WHEN (deduction_balance_materialized_1.deduction_amount_remaining = deduction_1.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_1.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state = 'BALANCED'::enum.deduction_balance_requested_state) AND ((CASE WHEN (deduction_balance_materialized_2.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_1.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_2.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state = 'OPEN'::enum.deduction_balance_allowed_state)) THEN 'COMPLETE'::text ELSE 'INVALID'::text END)::enum.deduction_state, (CASE WHEN (deduction_balance_materialized_3.deduction_amount_cleared = '0'::numeric) THEN 'OPEN'::text WHEN (((d_3.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_3.deduction_amount_cleared)::double precision) >= '0.01'::double precision) THEN 'PARTIAL'::text WHEN (((d_3.deduction_amount_requested)::double precision <-> (deduction_balance_materialized_3.deduction_amount_cleared)::double precision) < '0.01'::double precision) THEN 'CLEARED'::text ELSE NULL::text END)::enum.deduction_balance_allowed_state, (CASE WHEN (deduction_balance_materialized_4.deduction_amount_remaining = deduction_2.deduction_amount_requested) THEN 'NONE'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_4.deduction_amount_remaining)::double precision)) > '0.01'::double precision) THEN 'PARTIAL'::text WHEN (('0'::double precision <-> (@ (deduction_balance_materialized_4.deduction_amount_remaining)::double precision)) <= '0.01'::double precision) THEN 'BALANCED'::text ELSE NULL::text END)::enum.deduction_balance_requested_state, COALESCE(('RELIABLE'::enum.deduction_reliability_state), 'UNRELIABLE'::enum.deduction_reliability_state), deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, (string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text)), (COALESCE(deduction.deduction_date_closed, (now())::date) - deduction.deduction_date_created)
  • Inner Unique: true
  • Buffers: shared hit=194 read=46
3. 0.004 9.654 ↑ 50.0 2 1

Nested Loop Left Join (cost=837.79..1,763.92 rows=100 width=432) (actual time=8.375..9.654 rows=2 loops=1)

  • Output: company.company_name, company.company_number, ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed, (string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text)), ded.deduction_id, deduction_balance_materialized_4.deduction_amount_remaining, deduction_balance_materialized_4.deduction_id, deduction_balance_materialized.deduction_amount_remaining, deduction_balance_materialized.deduction_id, d_1.deduction_amount_requested, d_1.deduction_id, ('RELIABLE'::enum.deduction_reliability_state), ('RELIABLE'::enum.deduction_reliability_state)
  • Buffers: shared hit=150 read=45
4. 0.005 9.612 ↑ 50.0 2 1

Nested Loop (cost=835.97..1,409.51 rows=100 width=428) (actual time=8.348..9.612 rows=2 loops=1)

  • Output: company.company_name, company.company_number, ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed, (string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text)), ded.deduction_id, deduction_balance_materialized_4.deduction_amount_remaining, deduction_balance_materialized_4.deduction_id, deduction_balance_materialized.deduction_amount_remaining, deduction_balance_materialized.deduction_id, d_1.deduction_amount_requested, d_1.deduction_id, ('RELIABLE'::enum.deduction_reliability_state)
  • Inner Unique: true
  • Buffers: shared hit=115 read=45
5. 0.006 9.601 ↑ 50.0 2 1

Nested Loop Left Join (cost=835.55..1,360.11 rows=100 width=406) (actual time=8.342..9.601 rows=2 loops=1)

  • Output: company.company_name, company.company_number, ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed, (string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text)), ded.deduction_id, deduction_balance_materialized_4.deduction_amount_remaining, deduction_balance_materialized_4.deduction_id, deduction_balance_materialized.deduction_amount_remaining, deduction_balance_materialized.deduction_id, ('RELIABLE'::enum.deduction_reliability_state)
  • Buffers: shared hit=107 read=45
6. 0.004 9.513 ↑ 50.0 2 1

Nested Loop (cost=833.73..1,005.70 rows=100 width=402) (actual time=8.283..9.513 rows=2 loops=1)

  • Output: company.company_name, company.company_number, ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed, (string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text)), ded.deduction_id, deduction_balance_materialized_4.deduction_amount_remaining, deduction_balance_materialized_4.deduction_id, deduction_balance_materialized.deduction_amount_remaining, deduction_balance_materialized.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=74 read=43
7. 0.003 9.501 ↑ 50.0 2 1

Nested Loop (cost=833.44..972.87 rows=100 width=380) (actual time=8.274..9.501 rows=2 loops=1)

  • Output: company.company_name, company.company_number, ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed, (string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text)), ded.deduction_id, deduction_balance_materialized_4.deduction_amount_remaining, deduction_balance_materialized_4.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=68 read=43
8. 0.006 9.486 ↑ 50.0 2 1

Nested Loop (cost=833.15..940.05 rows=100 width=358) (actual time=8.265..9.486 rows=2 loops=1)

  • Output: company.company_name, company.company_number, ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed, (string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text)), ded.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=62 read=43
9. 0.084 9.460 ↑ 50.0 2 1

Merge Left Join (cost=832.73..895.63 rows=100 width=342) (actual time=8.248..9.460 rows=2 loops=1)

  • Output: company.company_name, company.company_number, ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed, (string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text))
  • Inner Unique: true
  • Merge Cond: (deduction.deduction_id = deduction_note.object_id)
  • Buffers: shared hit=55 read=43
10. 0.015 0.316 ↑ 50.0 2 1

Sort (cost=522.89..523.14 rows=100 width=310) (actual time=0.315..0.316 rows=2 loops=1)

  • Output: company.company_name, company.company_number, ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed
  • Sort Key: ded_1.deduction_id
  • Sort Method: quicksort Memory: 26kB
  • Buffers: shared hit=54 read=10
11. 0.005 0.301 ↑ 50.0 2 1

Nested Loop (cost=4.61..519.57 rows=100 width=310) (actual time=0.218..0.301 rows=2 loops=1)

  • Output: company.company_name, company.company_number, ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed
  • Inner Unique: true
  • Buffers: shared hit=54 read=10
12. 0.005 0.274 ↑ 50.0 2 1

Nested Loop (cost=4.32..485.20 rows=100 width=278) (actual time=0.197..0.274 rows=2 loops=1)

  • Output: ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id, deduction.deduction_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.deduction_active_state, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_label, deduction.client_check_number, deduction.deduction_date_closed
  • Inner Unique: true
  • Buffers: shared hit=49 read=9
13. 0.004 0.261 ↑ 50.0 2 1

Nested Loop (cost=3.91..435.80 rows=100 width=155) (actual time=0.189..0.261 rows=2 loops=1)

  • Output: ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id, d.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=41 read=9
14. 0.004 0.249 ↑ 50.0 2 1

Nested Loop (cost=3.49..391.38 rows=100 width=139) (actual time=0.181..0.249 rows=2 loops=1)

  • Output: ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id, deduction_1.deduction_amount_requested, deduction_1.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=34 read=9
15. 0.005 0.237 ↑ 50.0 2 1

Nested Loop (cost=3.08..341.97 rows=100 width=117) (actual time=0.173..0.237 rows=2 loops=1)

  • Output: ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id, deduction_2.deduction_amount_requested, deduction_2.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=26 read=9
16. 0.004 0.224 ↑ 50.0 2 1

Nested Loop (cost=2.66..292.57 rows=100 width=95) (actual time=0.165..0.224 rows=2 loops=1)

  • Output: ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id, deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=18 read=9
17. 0.004 0.212 ↑ 50.0 2 1

Nested Loop (cost=2.37..259.74 rows=100 width=73) (actual time=0.158..0.212 rows=2 loops=1)

  • Output: ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id, d_3.deduction_amount_requested, d_3.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=12 read=9
18. 0.005 0.156 ↑ 50.0 2 1

Nested Loop (cost=1.96..210.34 rows=100 width=51) (actual time=0.123..0.156 rows=2 loops=1)

  • Output: ded_1.deduction_id, unnest.unnest, deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=6 read=7
19. 0.005 0.111 ↑ 50.0 2 1

Nested Loop (cost=1.67..177.51 rows=100 width=32) (actual time=0.097..0.111 rows=2 loops=1)

  • Output: ded_1.deduction_id, unnest.unnest
  • Inner Unique: true
  • Buffers: shared hit=4 read=3
20. 0.011 0.024 ↑ 50.0 2 1

HashAggregate (cost=1.25..2.25 rows=100 width=16) (actual time=0.022..0.024 rows=2 loops=1)

  • Output: unnest.unnest
  • Group Key: unnest.unnest
21. 0.013 0.013 ↑ 50.0 2 1

Function Scan on pg_catalog.unnest (cost=0.00..1.00 rows=100 width=16) (actual time=0.012..0.013 rows=2 loops=1)

  • Output: unnest.unnest
  • Function Call: unnest('{889eb05b-982b-4241-a8d3-e4f2abd1f9dc,20e6f6ef-c979-4efc-acbc-ba87608a8d94}'::uuid[])
22. 0.082 0.082 ↑ 1.0 1 2

Index Only Scan using deduction_pkey on client_basic_american.deduction ded_1 (cost=0.41..1.75 rows=1 width=16) (actual time=0.041..0.041 rows=1 loops=2)

  • Output: ded_1.deduction_id
  • Index Cond: (ded_1.deduction_id = unnest.unnest)
  • Heap Fetches: 0
  • Buffers: shared hit=4 read=3
23. 0.040 0.040 ↑ 1.0 1 2

Index Scan using deduction_balance_materialized_pkey on client_basic_american.deduction_balance_materialized deduction_balance_materialized_2 (cost=0.29..0.33 rows=1 width=19) (actual time=0.020..0.020 rows=1 loops=2)

  • Output: deduction_balance_materialized_2.deduction_amount_cleared, deduction_balance_materialized_2.deduction_id
  • Index Cond: (deduction_balance_materialized_2.deduction_id = ded_1.deduction_id)
  • Buffers: shared hit=2 read=4
24. 0.052 0.052 ↑ 1.0 1 2

Index Scan using deduction_pkey on client_basic_american.deduction d_3 (cost=0.41..0.49 rows=1 width=22) (actual time=0.026..0.026 rows=1 loops=2)

  • Output: d_3.deduction_id, d_3.client_id, d_3.source_row_id, d_3.deduction_number, d_3.company_id, d_3.distributor_invoice_number, d_3.deduction_date_created, d_3.deduction_amount_requested, d_3.client_deduction_amount_open, d_3.client_deduction_reason_major, d_3.client_deduction_reason_minor, d_3.deduction_active_state, d_3.client_check_number, d_3.deduction_label, d_3.deduction_comment, d_3.client_deduction_comment, d_3.bill_to_company_number, d_3.ship_to_company_number, d_3.deduction_date_closed
  • Index Cond: (d_3.deduction_id = deduction_balance_materialized_2.deduction_id)
  • Buffers: shared hit=6 read=2
25. 0.008 0.008 ↑ 1.0 1 2

Index Scan using deduction_balance_materialized_pkey on client_basic_american.deduction_balance_materialized deduction_balance_materialized_1 (cost=0.29..0.33 rows=1 width=22) (actual time=0.004..0.004 rows=1 loops=2)

  • Output: deduction_balance_materialized_1.deduction_amount_remaining, deduction_balance_materialized_1.deduction_id
  • Index Cond: (deduction_balance_materialized_1.deduction_id = deduction_balance_materialized_2.deduction_id)
  • Buffers: shared hit=6
26. 0.008 0.008 ↑ 1.0 1 2

Index Scan using deduction_pkey on client_basic_american.deduction deduction_2 (cost=0.41..0.49 rows=1 width=22) (actual time=0.004..0.004 rows=1 loops=2)

  • Output: deduction_2.deduction_id, deduction_2.client_id, deduction_2.source_row_id, deduction_2.deduction_number, deduction_2.company_id, deduction_2.distributor_invoice_number, deduction_2.deduction_date_created, deduction_2.deduction_amount_requested, deduction_2.client_deduction_amount_open, deduction_2.client_deduction_reason_major, deduction_2.client_deduction_reason_minor, deduction_2.deduction_active_state, deduction_2.client_check_number, deduction_2.deduction_label, deduction_2.deduction_comment, deduction_2.client_deduction_comment, deduction_2.bill_to_company_number, deduction_2.ship_to_company_number, deduction_2.deduction_date_closed
  • Index Cond: (deduction_2.deduction_id = deduction_balance_materialized_1.deduction_id)
  • Buffers: shared hit=8
27. 0.008 0.008 ↑ 1.0 1 2

Index Scan using deduction_pkey on client_basic_american.deduction deduction_1 (cost=0.41..0.49 rows=1 width=22) (actual time=0.004..0.004 rows=1 loops=2)

  • Output: deduction_1.deduction_id, deduction_1.client_id, deduction_1.source_row_id, deduction_1.deduction_number, deduction_1.company_id, deduction_1.distributor_invoice_number, deduction_1.deduction_date_created, deduction_1.deduction_amount_requested, deduction_1.client_deduction_amount_open, deduction_1.client_deduction_reason_major, deduction_1.client_deduction_reason_minor, deduction_1.deduction_active_state, deduction_1.client_check_number, deduction_1.deduction_label, deduction_1.deduction_comment, deduction_1.client_deduction_comment, deduction_1.bill_to_company_number, deduction_1.ship_to_company_number, deduction_1.deduction_date_closed
  • Index Cond: (deduction_1.deduction_id = deduction_balance_materialized_1.deduction_id)
  • Buffers: shared hit=8
28. 0.008 0.008 ↑ 1.0 1 2

Index Only Scan using deduction_pkey on client_basic_american.deduction d (cost=0.41..0.44 rows=1 width=16) (actual time=0.004..0.004 rows=1 loops=2)

  • Output: d.deduction_id
  • Index Cond: (d.deduction_id = deduction_1.deduction_id)
  • Heap Fetches: 0
  • Buffers: shared hit=7
29. 0.008 0.008 ↑ 1.0 1 2

Index Scan using deduction_pkey on client_basic_american.deduction (cost=0.41..0.49 rows=1 width=123) (actual time=0.004..0.004 rows=1 loops=2)

  • Output: deduction.deduction_id, deduction.client_id, deduction.source_row_id, deduction.deduction_number, deduction.company_id, deduction.distributor_invoice_number, deduction.deduction_date_created, deduction.deduction_amount_requested, deduction.client_deduction_amount_open, deduction.client_deduction_reason_major, deduction.client_deduction_reason_minor, deduction.deduction_active_state, deduction.client_check_number, deduction.deduction_label, deduction.deduction_comment, deduction.client_deduction_comment, deduction.bill_to_company_number, deduction.ship_to_company_number, deduction.deduction_date_closed
  • Index Cond: (deduction.deduction_id = deduction_1.deduction_id)
  • Buffers: shared hit=8
30. 0.022 0.022 ↑ 1.0 1 2

Index Scan using company_pkey on client_basic_american.company (cost=0.29..0.34 rows=1 width=48) (actual time=0.011..0.011 rows=1 loops=2)

  • Output: company.company_id, company.client_id, company.company_name, company.company_number, company.company_type_id, company.active_ind, company.address_1, company.address_2, company.address_3, company.address_4, company.city, company.region, company.postal_code, company.country, company.company_agg_id, company.deduction_interval, company.alt_address_active, company.alt_address_1, company.alt_address_2, company.alt_address_3, company.alt_address_4, company.alt_city, company.alt_region, company.alt_postal_code, company.alt_country, company.atlas_company_id, company.email, company.tax_type_id, company.redistributor_ind, company.operator_request, company.early_payment_discount, company.vip
  • Index Cond: (company.company_id = deduction.company_id)
  • Buffers: shared hit=5 read=1
31. 1.441 9.060 ↑ 1.8 879 1

GroupAggregate (cost=309.84..352.73 rows=1,557 width=48) (actual time=7.561..9.060 rows=879 loops=1)

  • Output: deduction_note.object_id, string_agg(format('%1$s - %2$s: %3$s'::text, deduction_note.note_timestamp, ((account_foreign.first_name || ' '::text) || account_foreign.last_name), deduction_note.note), ' ~~ '::text)
  • Group Key: deduction_note.object_id
  • Buffers: shared hit=1 read=33
32. 0.780 7.619 ↑ 1.7 894 1

Sort (cost=309.84..313.74 rows=1,562 width=114) (actual time=7.538..7.619 rows=894 loops=1)

  • Output: deduction_note.object_id, deduction_note.note_timestamp, account_foreign.first_name, account_foreign.last_name, deduction_note.note
  • Sort Key: deduction_note.object_id
  • Sort Method: quicksort Memory: 365kB
  • Buffers: shared hit=1 read=33
33. 0.555 6.839 ↓ 1.0 1,578 1

Hash Join (cost=157.88..226.98 rows=1,562 width=114) (actual time=5.996..6.839 rows=1,578 loops=1)

  • Output: deduction_note.object_id, deduction_note.note_timestamp, account_foreign.first_name, account_foreign.last_name, deduction_note.note
  • Hash Cond: (deduction_note.account_id = account_client.account_id)
  • Buffers: shared hit=1 read=33
34. 0.321 0.321 ↓ 1.0 1,578 1

Seq Scan on client_basic_american.deduction_note (cost=0.00..47.62 rows=1,562 width=117) (actual time=0.022..0.321 rows=1,578 loops=1)

  • Output: deduction_note.note_id, deduction_note.object_id, deduction_note.account_id, deduction_note.note, deduction_note.note_timestamp, deduction_note.notify_account_ids
  • Buffers: shared read=32
35. 0.024 5.963 ↑ 1.0 103 1

Hash (cost=156.59..156.59 rows=103 width=29) (actual time=5.963..5.963 rows=103 loops=1)

  • Output: account_foreign.first_name, account_foreign.last_name, account_client.account_id
  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
  • Buffers: shared hit=1 read=1
36. 0.187 5.939 ↑ 1.0 103 1

Hash Join (cost=104.32..156.59 rows=103 width=29) (actual time=5.692..5.939 rows=103 loops=1)

  • Output: account_foreign.first_name, account_foreign.last_name, account_client.account_id
  • Inner Unique: true
  • Hash Cond: (account_foreign.account_id = account_client.account_id_foreign)
  • Buffers: shared hit=1 read=1
37. 5.665 5.665 ↓ 1.3 1,240 1

Foreign Scan on global.account_foreign (cost=100.00..149.67 rows=989 width=29) (actual time=5.586..5.665 rows=1,240 loops=1)

  • Output: account_foreign.account_id, account_foreign.email, account_foreign.password, account_foreign.first_name, account_foreign.last_name, account_foreign.create_date, account_foreign.timezone
  • Remote SQL: SELECT account_id, first_name, last_name FROM public.account
38. 0.041 0.087 ↑ 1.0 103 1

Hash (cost=3.03..3.03 rows=103 width=32) (actual time=0.087..0.087 rows=103 loops=1)

  • Output: account_client.account_id_foreign, account_client.account_id
  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
  • Buffers: shared hit=1 read=1
39. 0.046 0.046 ↑ 1.0 103 1

Seq Scan on client_basic_american.account_client (cost=0.00..3.03 rows=103 width=32) (actual time=0.005..0.046 rows=103 loops=1)

  • Output: account_client.account_id_foreign, account_client.account_id
  • Buffers: shared hit=1 read=1
40. 0.020 0.020 ↑ 1.0 1 2

Index Only Scan using deduction_pkey on client_basic_american.deduction ded (cost=0.41..0.44 rows=1 width=16) (actual time=0.009..0.010 rows=1 loops=2)

  • Output: ded.deduction_id
  • Index Cond: (ded.deduction_id = deduction.deduction_id)
  • Heap Fetches: 0
  • Buffers: shared hit=7
41. 0.012 0.012 ↑ 1.0 1 2

Index Scan using deduction_balance_materialized_pkey on client_basic_american.deduction_balance_materialized deduction_balance_materialized_4 (cost=0.29..0.33 rows=1 width=22) (actual time=0.006..0.006 rows=1 loops=2)

  • Output: deduction_balance_materialized_4.deduction_amount_remaining, deduction_balance_materialized_4.deduction_id
  • Index Cond: (deduction_balance_materialized_4.deduction_id = deduction.deduction_id)
  • Buffers: shared hit=6
42. 0.008 0.008 ↑ 1.0 1 2

Index Scan using deduction_balance_materialized_pkey on client_basic_american.deduction_balance_materialized (cost=0.29..0.33 rows=1 width=22) (actual time=0.004..0.004 rows=1 loops=2)

  • Output: deduction_balance_materialized.deduction_amount_remaining, deduction_balance_materialized.deduction_id
  • Index Cond: (deduction_balance_materialized.deduction_id = deduction.deduction_id)
  • Buffers: shared hit=6
43. 0.004 0.082 ↑ 1.0 1 2

Nested Loop Anti Join (cost=1.83..3.53 rows=1 width=20) (actual time=0.041..0.041 rows=1 loops=2)

  • Output: d_4.deduction_id, 'RELIABLE'::enum.deduction_reliability_state
  • Buffers: shared hit=33 read=2
44. 0.002 0.062 ↑ 1.0 1 2

Nested Loop Semi Join (cost=1.12..1.99 rows=1 width=16) (actual time=0.031..0.031 rows=1 loops=2)

  • Output: d_4.deduction_id
  • Buffers: shared hit=19 read=2
45. 0.012 0.012 ↑ 1.0 1 2

Index Only Scan using deduction_pkey on client_basic_american.deduction d_4 (cost=0.41..0.44 rows=1 width=16) (actual time=0.005..0.006 rows=1 loops=2)

  • Output: d_4.deduction_id
  • Index Cond: (d_4.deduction_id = ded_1.deduction_id)
  • Heap Fetches: 0
  • Buffers: shared hit=7
46. 0.002 0.048 ↑ 1.0 1 2

Nested Loop (cost=0.71..1.53 rows=1 width=16) (actual time=0.024..0.024 rows=1 loops=2)

  • Output: deduction_claim_2.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=12 read=2
47. 0.030 0.030 ↑ 1.0 1 2

Index Scan using idx_deduction_claim_deduction_id on client_basic_american.deduction_claim deduction_claim_2 (cost=0.29..0.31 rows=1 width=32) (actual time=0.015..0.015 rows=1 loops=2)

  • Output: deduction_claim_2.deduction_id, deduction_claim_2.claim_id, deduction_claim_2.deduction_amount_allotted, deduction_claim_2.active_range, deduction_claim_2.inoperative, deduction_claim_2.deduction_claim_id, deduction_claim_2.match_account_id, deduction_claim_2.unmatch_account_id
  • Index Cond: (deduction_claim_2.deduction_id = d_4.deduction_id)
  • Buffers: shared hit=4 read=2
48. 0.016 0.016 ↑ 1.0 1 2

Index Scan using claim_pkey on client_basic_american.claim cl_2 (cost=0.42..1.22 rows=1 width=16) (actual time=0.008..0.008 rows=1 loops=2)

  • Output: cl_2.claim_id, cl_2.invoice_id, cl_2.claim_state, cl_2.claim_sequence, cl_2.transaction_type, cl_2.contract_sequence, cl_2.claim_tag
  • Index Cond: (cl_2.claim_id = deduction_claim_2.claim_id)
  • Filter: (cl_2.claim_state = ANY ('{COMPLETE,REJECTED}'::enum.claim_state[]))
  • Buffers: shared hit=8
49. 0.002 0.016 ↓ 0.0 0 2

Nested Loop (cost=0.71..1.54 rows=1 width=16) (actual time=0.008..0.008 rows=0 loops=2)

  • Output: deduction_claim_3.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=14
50. 0.006 0.006 ↑ 1.0 1 2

Index Scan using idx_deduction_claim_deduction_id on client_basic_american.deduction_claim deduction_claim_3 (cost=0.29..0.31 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=2)

  • Output: deduction_claim_3.deduction_id, deduction_claim_3.claim_id, deduction_claim_3.deduction_amount_allotted, deduction_claim_3.active_range, deduction_claim_3.inoperative, deduction_claim_3.deduction_claim_id, deduction_claim_3.match_account_id, deduction_claim_3.unmatch_account_id
  • Index Cond: (d_4.deduction_id = deduction_claim_3.deduction_id)
  • Buffers: shared hit=6
51. 0.008 0.008 ↓ 0.0 0 2

Index Scan using claim_pkey on client_basic_american.claim cl_3 (cost=0.42..1.22 rows=1 width=16) (actual time=0.004..0.004 rows=0 loops=2)

  • Output: cl_3.claim_id, cl_3.invoice_id, cl_3.claim_state, cl_3.claim_sequence, cl_3.transaction_type, cl_3.contract_sequence, cl_3.claim_tag
  • Index Cond: (cl_3.claim_id = deduction_claim_3.claim_id)
  • Filter: (cl_3.claim_state <> ALL ('{COMPLETE,REJECTED}'::enum.claim_state[]))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=8
52. 0.006 0.006 ↑ 1.0 1 2

Index Scan using deduction_pkey on client_basic_american.deduction d_1 (cost=0.41..0.49 rows=1 width=22) (actual time=0.003..0.003 rows=1 loops=2)

  • Output: d_1.deduction_id, d_1.client_id, d_1.source_row_id, d_1.deduction_number, d_1.company_id, d_1.distributor_invoice_number, d_1.deduction_date_created, d_1.deduction_amount_requested, d_1.client_deduction_amount_open, d_1.client_deduction_reason_major, d_1.client_deduction_reason_minor, d_1.deduction_active_state, d_1.client_check_number, d_1.deduction_label, d_1.deduction_comment, d_1.client_deduction_comment, d_1.bill_to_company_number, d_1.ship_to_company_number, d_1.deduction_date_closed
  • Index Cond: (d_1.deduction_id = deduction.deduction_id)
  • Buffers: shared hit=8
53. 0.004 0.038 ↑ 1.0 1 2

Nested Loop Semi Join (cost=1.83..3.53 rows=1 width=20) (actual time=0.018..0.019 rows=1 loops=2)

  • Output: d_2.deduction_id, 'RELIABLE'::enum.deduction_reliability_state
  • Buffers: shared hit=35
54. 0.002 0.022 ↑ 1.0 1 2

Nested Loop Anti Join (cost=1.12..1.99 rows=1 width=16) (actual time=0.010..0.011 rows=1 loops=2)

  • Output: d_2.deduction_id
  • Buffers: shared hit=21
55. 0.006 0.006 ↑ 1.0 1 2

Index Only Scan using deduction_pkey on client_basic_american.deduction d_2 (cost=0.41..0.44 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=2)

  • Output: d_2.deduction_id
  • Index Cond: (d_2.deduction_id = ded.deduction_id)
  • Heap Fetches: 0
  • Buffers: shared hit=7
56. 0.004 0.014 ↓ 0.0 0 2

Nested Loop (cost=0.71..1.54 rows=1 width=16) (actual time=0.007..0.007 rows=0 loops=2)

  • Output: deduction_claim_1.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=14
57. 0.004 0.004 ↑ 1.0 1 2

Index Scan using idx_deduction_claim_deduction_id on client_basic_american.deduction_claim deduction_claim_1 (cost=0.29..0.31 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=2)

  • Output: deduction_claim_1.deduction_id, deduction_claim_1.claim_id, deduction_claim_1.deduction_amount_allotted, deduction_claim_1.active_range, deduction_claim_1.inoperative, deduction_claim_1.deduction_claim_id, deduction_claim_1.match_account_id, deduction_claim_1.unmatch_account_id
  • Index Cond: (d_2.deduction_id = deduction_claim_1.deduction_id)
  • Buffers: shared hit=6
58. 0.006 0.006 ↓ 0.0 0 2

Index Scan using claim_pkey on client_basic_american.claim cl_1 (cost=0.42..1.22 rows=1 width=16) (actual time=0.003..0.003 rows=0 loops=2)

  • Output: cl_1.claim_id, cl_1.invoice_id, cl_1.claim_state, cl_1.claim_sequence, cl_1.transaction_type, cl_1.contract_sequence, cl_1.claim_tag
  • Index Cond: (cl_1.claim_id = deduction_claim_1.claim_id)
  • Filter: (cl_1.claim_state <> ALL ('{COMPLETE,REJECTED}'::enum.claim_state[]))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=8
59. 0.002 0.012 ↑ 1.0 1 2

Nested Loop (cost=0.71..1.53 rows=1 width=16) (actual time=0.006..0.006 rows=1 loops=2)

  • Output: deduction_claim.deduction_id
  • Inner Unique: true
  • Buffers: shared hit=14
60. 0.004 0.004 ↑ 1.0 1 2

Index Scan using idx_deduction_claim_deduction_id on client_basic_american.deduction_claim (cost=0.29..0.31 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=2)

  • Output: deduction_claim.deduction_id, deduction_claim.claim_id, deduction_claim.deduction_amount_allotted, deduction_claim.active_range, deduction_claim.inoperative, deduction_claim.deduction_claim_id, deduction_claim.match_account_id, deduction_claim.unmatch_account_id
  • Index Cond: (deduction_claim.deduction_id = d_2.deduction_id)
  • Buffers: shared hit=6
61. 0.006 0.006 ↑ 1.0 1 2

Index Scan using claim_pkey on client_basic_american.claim cl (cost=0.42..1.22 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=2)

  • Output: cl.claim_id, cl.invoice_id, cl.claim_state, cl.claim_sequence, cl.transaction_type, cl.contract_sequence, cl.claim_tag
  • Index Cond: (cl.claim_id = deduction_claim.claim_id)
  • Filter: (cl.claim_state = ANY ('{COMPLETE,REJECTED}'::enum.claim_state[]))
  • Buffers: shared hit=8
62. 0.004 0.004 ↑ 1.0 1 2

Index Scan using deduction_balance_materialized_pkey on client_basic_american.deduction_balance_materialized deduction_balance_materialized_3 (cost=0.29..0.33 rows=1 width=19) (actual time=0.002..0.002 rows=1 loops=2)

  • Output: deduction_balance_materialized_3.deduction_amount_cleared, deduction_balance_materialized_3.deduction_id
  • Index Cond: (deduction_balance_materialized_3.deduction_id = deduction.deduction_id)
  • Buffers: shared hit=6
Planning time : 812.581 ms
Execution time : 43.025 ms