explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5BS4

Settings
# exclusive inclusive rows x rows loops node
1. 1.830 387.044 ↓ 609.0 609 1

Sort (cost=8,733.29..8,733.29 rows=1 width=437) (actual time=386.986..387.044 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, product.product_name, product.product_number, product_uom_conversions.uom_type_ids, claim_product.distributor_company_id, company.company_name, company.company_number, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, ((CASE WHEN (pm.math_operation_value IS NULL) THEN price_default.price WHEN (pm.math_operation IS NULL) THEN price_default.price WHEN (pm.math_operation = 'ADD'::enum.math_operation) THEN (price_default.price + pm.math_operation_value) WHEN (pm.math_operation = 'SUBTRACT'::enum.math_operation) THEN (price_default.price - pm.math_operation_value) WHEN (pm.math_operation = 'MULTIPLY'::enum.math_operation) THEN (price_default.price * pm.math_operation_value) ELSE price_default.price END / (tuomc_1.rate / suomc_1.rate))), ('DEFAULT'::enum.price_tier), claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, contract_item.contract_id, contract_family.contract_title, ((((((contract_family_1.contract_sequence)::text || '.R'::text) || (contract_renew_version_view.contract_renew_version)::text) || '.A'::text) || (contract_amend_version_view.contract_amend_version)::text)), contract_item.won, ((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method), (CASE WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'GROWTH'::enum.contract_rebate_method) THEN contract_item.rebate_growth_type WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'DIRECT'::enum.contract_rebate_method) THEN contract_item.rebate_direct_type WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'DEVIATED'::enum.contract_rebate_method) THEN contract_item.rebate_deviated_type ELSE NULL::enum.rebate_value_type END), (CASE WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'GROWTH'::enum.contract_rebate_method) THEN contract_item.rebate_growth_decimal_model WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'DIRECT'::enum.contract_rebate_method) THEN contract_item.rebate_direct_decimal_model WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'DEVIATED'::enum.contract_rebate_method) THEN contract_item.rebate_deviated_decimal_model ELSE NULL::enum.decimal_model END), (CASE ((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) WHEN 'GROWTH'::enum.contract_rebate_method THEN NULL::numeric WHEN 'DIRECT'::enum.contract_rebate_method THEN CASE WHEN (contract_item.rebate_direct_type = 'FIXED_RATE'::enum.rebate_value_type) THEN CASE WHEN (contract_item.rebate_direct_decimal_model = 'NUMERIC'::enum.decimal_model) THEN (contract_item.rebate_direct_value / (tuomc.rate / suomc.rate)) WHEN (contract_item.rebate_direct_decimal_model = 'PERCENT'::enum.decimal_model) THEN contract_item.rebate_direct_value ELSE NULL::numeric END WHEN (contract_item.rebate_direct_type = 'FIXED_PRICE'::enum.rebate_value_type) THEN CASE WHEN (contract_item.rebate_direct_decimal_model = 'NUMERIC'::enum.decimal_model) THEN (contract_item.rebate_direct_value / (tuomc.rate / suomc.rate)) ELSE NULL::numeric END ELSE NULL::numeric END WHEN 'DEVIATED'::enum.contract_rebate_method THEN CASE WHEN (contract_item.rebate_deviated_type = 'FIXED_RATE'::enum.rebate_value_type) THEN CASE WHEN (contract_item.rebate_deviated_decimal_model = 'NUMERIC'::enum.decimal_model) THEN (contract_item.rebate_deviated_value / (tuomc.rate / suomc.rate)) WHEN (contract_item.rebate_deviated_decimal_model = 'PERCENT'::enum.decimal_model) THEN contract_item.rebate_deviated_value ELSE NULL::numeric END WHEN (contract_item.rebate_deviated_type = 'FIXED_PRICE'::enum.rebate_value_type) THEN CASE WHEN (contract_item.rebate_deviated_decimal_model = 'NUMERIC'::enum.decimal_model) THEN (contract_item.rebate_deviated_value / (tuomc.rate / suomc.rate)) ELSE NULL::numeric END ELSE NULL::numeric END ELSE NULL::numeric END), (COALESCE(claim_product.distributor_invoice_number, (string_agg(claim_product_location.distributor_invoice_number, ', '::text)))), ((cpo.display_order)::integer), cpo.display_order
  • Sort Key: cpo.display_order
  • Sort Method: quicksort Memory: 338kB
  • Buffers: shared hit=30619
2. 42.665 385.214 ↓ 609.0 609 1

Nested Loop Left Join (cost=7,268.43..8,733.28 rows=1 width=437) (actual time=104.052..385.214 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, product.product_name, product.product_number, product_uom_conversions.uom_type_ids, claim_product.distributor_company_id, company.company_name, company.company_number, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, ((CASE WHEN (pm.math_operation_value IS NULL) THEN price_default.price WHEN (pm.math_operation IS NULL) THEN price_default.price WHEN (pm.math_operation = 'ADD'::enum.math_operation) THEN (price_default.price + pm.math_operation_value) WHEN (pm.math_operation = 'SUBTRACT'::enum.math_operation) THEN (price_default.price - pm.math_operation_value) WHEN (pm.math_operation = 'MULTIPLY'::enum.math_operation) THEN (price_default.price * pm.math_operation_value) ELSE price_default.price END / (tuomc_1.rate / suomc_1.rate))), ('DEFAULT'::enum.price_tier), claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, contract_item.contract_id, contract_family.contract_title, (((((contract_family_1.contract_sequence)::text || '.R'::text) || (contract_renew_version_view.contract_renew_version)::text) || '.A'::text) || (contract_amend_version_view.contract_amend_version)::text), contract_item.won, ((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method), CASE WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'GROWTH'::enum.contract_rebate_method) THEN contract_item.rebate_growth_type WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'DIRECT'::enum.contract_rebate_method) THEN contract_item.rebate_direct_type WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'DEVIATED'::enum.contract_rebate_method) THEN contract_item.rebate_deviated_type ELSE NULL::enum.rebate_value_type END, CASE WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'GROWTH'::enum.contract_rebate_method) THEN contract_item.rebate_growth_decimal_model WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'DIRECT'::enum.contract_rebate_method) THEN contract_item.rebate_direct_decimal_model WHEN (((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) = 'DEVIATED'::enum.contract_rebate_method) THEN contract_item.rebate_deviated_decimal_model ELSE NULL::enum.decimal_model END, CASE ((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method) WHEN 'GROWTH'::enum.contract_rebate_method THEN NULL::numeric WHEN 'DIRECT'::enum.contract_rebate_method THEN CASE WHEN (contract_item.rebate_direct_type = 'FIXED_RATE'::enum.rebate_value_type) THEN CASE WHEN (contract_item.rebate_direct_decimal_model = 'NUMERIC'::enum.decimal_model) THEN (contract_item.rebate_direct_value / (tuomc.rate / suomc.rate)) WHEN (contract_item.rebate_direct_decimal_model = 'PERCENT'::enum.decimal_model) THEN contract_item.rebate_direct_value ELSE NULL::numeric END WHEN (contract_item.rebate_direct_type = 'FIXED_PRICE'::enum.rebate_value_type) THEN CASE WHEN (contract_item.rebate_direct_decimal_model = 'NUMERIC'::enum.decimal_model) THEN (contract_item.rebate_direct_value / (tuomc.rate / suomc.rate)) ELSE NULL::numeric END ELSE NULL::numeric END WHEN 'DEVIATED'::enum.contract_rebate_method THEN CASE WHEN (contract_item.rebate_deviated_type = 'FIXED_RATE'::enum.rebate_value_type) THEN CASE WHEN (contract_item.rebate_deviated_decimal_model = 'NUMERIC'::enum.decimal_model) THEN (contract_item.rebate_deviated_value / (tuomc.rate / suomc.rate)) WHEN (contract_item.rebate_deviated_decimal_model = 'PERCENT'::enum.decimal_model) THEN contract_item.rebate_deviated_value ELSE NULL::numeric END WHEN (contract_item.rebate_deviated_type = 'FIXED_PRICE'::enum.rebate_value_type) THEN CASE WHEN (contract_item.rebate_deviated_decimal_model = 'NUMERIC'::enum.decimal_model) THEN (contract_item.rebate_deviated_value / (tuomc.rate / suomc.rate)) ELSE NULL::numeric END ELSE NULL::numeric END ELSE NULL::numeric END, COALESCE(claim_product.distributor_invoice_number, (string_agg(claim_product_location.distributor_invoice_number, ', '::text))), (cpo.display_order)::integer, cpo.display_order
  • Join Filter: ((claim_product.claim_id = cpo.claim_id) AND (claim_product.claim_product_id = cpo.claim_product_id))
  • Rows Removed by Join Filter: 370272
  • Buffers: shared hit=30619
3. 0.348 154.368 ↓ 609.0 609 1

Nested Loop Left Join (cost=7,268.01..8,726.48 rows=1 width=439) (actual time=103.854..154.368 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_family.contract_title, suomc.rate, tuomc.rate, contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version, ((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method), ('DEFAULT'::enum.price_tier), product_uom_conversions.uom_type_ids, (string_agg(claim_product_location.distributor_invoice_number, ', '::text)), ((CASE WHEN (pm.math_operation_value IS NULL) THEN price_default.price WHEN (pm.math_operation IS NULL) THEN price_default.price WHEN (pm.math_operation = 'ADD'::enum.math_operation) THEN (price_default.price + pm.math_operation_value) WHEN (pm.math_operation = 'SUBTRACT'::enum.math_operation) THEN (price_default.price - pm.math_operation_value) WHEN (pm.math_operation = 'MULTIPLY'::enum.math_operation) THEN (price_default.price * pm.math_operation_value) ELSE price_default.price END / (tuomc_1.rate / suomc_1.rate)))
  • Inner Unique: true
  • Join Filter: ((claim_product.claim_id = claim_product_3.claim_id) AND (claim_product.claim_product_id = claim_product_location.claim_product_id))
  • Buffers: shared hit=25747
4. 0.329 150.975 ↓ 609.0 609 1

Nested Loop Left Join (cost=6,869.20..8,324.34 rows=1 width=407) (actual time=101.387..150.975 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_family.contract_title, suomc.rate, tuomc.rate, contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version, ((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method), ('DEFAULT'::enum.price_tier), product_uom_conversions.uom_type_ids, ((CASE WHEN (pm.math_operation_value IS NULL) THEN price_default.price WHEN (pm.math_operation IS NULL) THEN price_default.price WHEN (pm.math_operation = 'ADD'::enum.math_operation) THEN (price_default.price + pm.math_operation_value) WHEN (pm.math_operation = 'SUBTRACT'::enum.math_operation) THEN (price_default.price - pm.math_operation_value) WHEN (pm.math_operation = 'MULTIPLY'::enum.math_operation) THEN (price_default.price * pm.math_operation_value) ELSE price_default.price END / (tuomc_1.rate / suomc_1.rate)))
  • Buffers: shared hit=23195
5. 0.849 142.120 ↓ 609.0 609 1

Hash Join (cost=6,866.94..8,286.69 rows=1 width=371) (actual time=101.333..142.120 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_family.contract_title, suomc.rate, tuomc.rate, contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version, ((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method), product_uom_conversions.uom_type_ids
  • Hash Cond: (claim_product.claim_product_id = product_uom_conversions.claim_product_id)
  • Buffers: shared hit=18925
6. 0.886 139.086 ↓ 5.7 609 1

Nested Loop Left Join (cost=6,641.83..8,061.18 rows=106 width=339) (actual time=99.132..139.086 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_family.contract_title, suomc.rate, tuomc.rate, contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version, ((CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method)
  • Buffers: shared hit=17590
7. 0.742 137.591 ↓ 5.7 609 1

Nested Loop Left Join (cost=6,641.83..8,054.82 rows=106 width=347) (actual time=99.116..137.591 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, claimant_company_type.internal_company_type, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_family.contract_title, contract_family.contract_type, ct.internal_company_type, suomc.rate, tuomc.rate, contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version
  • Join Filter: (contract_item.uom_type_id = suomc.uom_type_id)
  • Rows Removed by Join Filter: 8
  • Buffers: shared hit=17590
8. 0.553 131.368 ↓ 5.7 609 1

Nested Loop Left Join (cost=6,640.99..7,920.20 rows=106 width=353) (actual time=99.068..131.368 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, claimant_company_type.internal_company_type, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_item.uom_type_id, contract_family.contract_title, contract_family.contract_type, ct.internal_company_type, contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version
  • Buffers: shared hit=12696
9. 1.021 124.725 ↓ 5.7 609 1

Nested Loop Left Join (cost=6,640.16..7,790.89 rows=106 width=365) (actual time=99.008..124.725 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, claimant_company_type.internal_company_type, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_item.uom_type_id, contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version, contract_family.contract_title, contract_family.contract_type, contract_family.contract_family_id
  • Inner Unique: true
  • Buffers: shared hit=7824
10. 3.265 121.877 ↓ 5.7 609 1

Hash Right Join (cost=6,639.87..7,441.09 rows=106 width=319) (actual time=98.978..121.877 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_item.uom_type_id, contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version
  • Hash Cond: (contract_amend_version.contract_amend_version_id = contract_item.contract_id)
  • Buffers: shared hit=5997
11. 8.227 113.145 ↑ 1.0 18,396 1

Hash Join (cost=5,754.27..6,416.46 rows=18,396 width=36) (actual time=81.224..113.145 rows=18,396 loops=1)

  • Output: contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version.contract_amend_version_id, contract_amend_version_view.contract_amend_version
  • Inner Unique: true
  • Hash Cond: (contract_amend_version.contract_amend_version_id = contract_amend_version_view.contract_amend_version_id)
  • Buffers: shared hit=1539
12. 7.170 65.594 ↑ 1.0 18,396 1

Hash Join (cost=2,858.18..3,472.06 rows=18,396 width=28) (actual time=41.714..65.594 rows=18,396 loops=1)

  • Output: contract_family_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version.contract_amend_version_id
  • Inner Unique: true
  • Hash Cond: (contract_renew_version.contract_renew_version_id = contract_renew_version_view.contract_renew_version_id)
  • Buffers: shared hit=969
13. 5.873 24.352 ↑ 1.0 18,396 1

Hash Join (cost=807.59..1,373.17 rows=18,396 width=52) (actual time=7.548..24.352 rows=18,396 loops=1)

  • Output: contract_family_1.contract_sequence, contract_renew_version.contract_renew_version_id, contract_amend_version.contract_renew_version_id, contract_amend_version.contract_amend_version_id
  • Inner Unique: true
  • Hash Cond: (contract_renew_version.contract_family_id = contract_family_1.contract_family_id)
  • Buffers: shared hit=667
14. 9.067 16.063 ↑ 1.0 18,396 1

Hash Join (cost=448.79..966.05 rows=18,396 width=64) (actual time=5.073..16.063 rows=18,396 loops=1)

  • Output: contract_renew_version.contract_family_id, contract_renew_version.contract_renew_version_id, contract_amend_version.contract_renew_version_id, contract_amend_version.contract_amend_version_id
  • Inner Unique: true
  • Hash Cond: (contract_amend_version.contract_renew_version_id = contract_renew_version.contract_renew_version_id)
  • Buffers: shared hit=436
15. 2.019 2.019 ↑ 1.0 18,396 1

Seq Scan on client_pinnacle.contract_amend_version (cost=0.00..468.96 rows=18,396 width=32) (actual time=0.005..2.019 rows=18,396 loops=1)

  • Output: contract_amend_version.contract_amend_version_id, contract_amend_version.contract_renew_version_id, contract_amend_version.contract_state, contract_amend_version.contract_amend_version_parent_id, contract_amend_version.contract_name, contract_amend_version.contact_name, contract_amend_version.contact_email, contract_amend_version.contact_phone, contract_amend_version.create_timestamp
  • Buffers: shared hit=285
16. 2.799 4.977 ↑ 1.0 13,235 1

Hash (cost=283.35..283.35 rows=13,235 width=32) (actual time=4.977..4.977 rows=13,235 loops=1)

  • Output: contract_renew_version.contract_family_id, contract_renew_version.contract_renew_version_id
  • Buckets: 16384 Batches: 1 Memory Usage: 956kB
  • Buffers: shared hit=151
17. 2.178 2.178 ↑ 1.0 13,235 1

Seq Scan on client_pinnacle.contract_renew_version (cost=0.00..283.35 rows=13,235 width=32) (actual time=0.005..2.178 rows=13,235 loops=1)

  • Output: contract_renew_version.contract_family_id, contract_renew_version.contract_renew_version_id
  • Buffers: shared hit=151
18. 1.153 2.416 ↑ 1.0 5,680 1

Hash (cost=287.80..287.80 rows=5,680 width=20) (actual time=2.416..2.416 rows=5,680 loops=1)

  • Output: contract_family_1.contract_sequence, contract_family_1.contract_family_id
  • Buckets: 8192 Batches: 1 Memory Usage: 353kB
  • Buffers: shared hit=231
19. 1.263 1.263 ↑ 1.0 5,680 1

Seq Scan on client_pinnacle.contract_family contract_family_1 (cost=0.00..287.80 rows=5,680 width=20) (actual time=0.020..1.263 rows=5,680 loops=1)

  • Output: contract_family_1.contract_sequence, contract_family_1.contract_family_id
  • Buffers: shared hit=231
20. 2.747 34.072 ↑ 1.0 13,235 1

Hash (cost=1,885.15..1,885.15 rows=13,235 width=24) (actual time=34.071..34.072 rows=13,235 loops=1)

  • Output: contract_renew_version_view.contract_renew_version, contract_renew_version_view.contract_renew_version_id
  • Buckets: 16384 Batches: 1 Memory Usage: 852kB
  • Buffers: shared hit=302
21. 1.698 31.325 ↑ 1.0 13,235 1

Subquery Scan on contract_renew_version_view (cost=1,620.45..1,885.15 rows=13,235 width=24) (actual time=26.539..31.325 rows=13,235 loops=1)

  • Output: contract_renew_version_view.contract_renew_version, contract_renew_version_view.contract_renew_version_id
  • Buffers: shared hit=302
22. 11.617 29.627 ↑ 1.0 13,235 1

HashAggregate (cost=1,620.45..1,752.80 rows=13,235 width=24) (actual time=26.538..29.627 rows=13,235 loops=1)

  • Output: crv1.contract_renew_version_id, count(crv2.contract_renew_version_id)
  • Group Key: crv1.contract_renew_version_id
  • Buffers: shared hit=302
23. 11.539 18.010 ↓ 1.8 24,312 1

Hash Left Join (cost=448.79..1,554.28 rows=13,235 width=32) (actual time=5.308..18.010 rows=24,312 loops=1)

  • Output: crv1.contract_renew_version_id, crv2.contract_renew_version_id
  • Hash Cond: (crv1.contract_family_id = crv2.contract_family_id)
  • Join Filter: (crv2.create_timestamp < crv1.create_timestamp)
  • Rows Removed by Join Filter: 32009
  • Buffers: shared hit=302
24. 1.259 1.259 ↑ 1.0 13,235 1

Seq Scan on client_pinnacle.contract_renew_version crv1 (cost=0.00..283.35 rows=13,235 width=40) (actual time=0.004..1.259 rows=13,235 loops=1)

  • Output: crv1.contract_renew_version_id, crv1.contract_family_id, crv1.date_range, crv1.create_timestamp, crv1.dead
  • Buffers: shared hit=151
25. 2.981 5.212 ↑ 1.0 13,235 1

Hash (cost=283.35..283.35 rows=13,235 width=40) (actual time=5.212..5.212 rows=13,235 loops=1)

  • Output: crv2.contract_renew_version_id, crv2.contract_family_id, crv2.create_timestamp
  • Buckets: 16384 Batches: 1 Memory Usage: 1059kB
  • Buffers: shared hit=151
26. 2.231 2.231 ↑ 1.0 13,235 1

Seq Scan on client_pinnacle.contract_renew_version crv2 (cost=0.00..283.35 rows=13,235 width=40) (actual time=0.002..2.231 rows=13,235 loops=1)

  • Output: crv2.contract_renew_version_id, crv2.contract_family_id, crv2.create_timestamp
  • Buffers: shared hit=151
27. 4.154 39.324 ↑ 1.0 18,396 1

Hash (cost=2,666.15..2,666.15 rows=18,396 width=24) (actual time=39.324..39.324 rows=18,396 loops=1)

  • Output: contract_amend_version_view.contract_amend_version, contract_amend_version_view.contract_amend_version_id
  • Buckets: 32768 Batches: 1 Memory Usage: 1263kB
  • Buffers: shared hit=570
28. 2.391 35.170 ↑ 1.0 18,396 1

Subquery Scan on contract_amend_version_view (cost=2,298.23..2,666.15 rows=18,396 width=24) (actual time=28.987..35.170 rows=18,396 loops=1)

  • Output: contract_amend_version_view.contract_amend_version, contract_amend_version_view.contract_amend_version_id
  • Buffers: shared hit=570
29. 11.014 32.779 ↑ 1.0 18,396 1

HashAggregate (cost=2,298.23..2,482.19 rows=18,396 width=24) (actual time=28.986..32.779 rows=18,396 loops=1)

  • Output: cav1.contract_amend_version_id, count(cav2.contract_amend_version_id)
  • Group Key: cav1.contract_amend_version_id
  • Buffers: shared hit=570
30. 11.834 21.765 ↓ 1.1 19,996 1

Hash Left Join (cost=698.91..2,206.25 rows=18,396 width=32) (actual time=8.378..21.765 rows=19,996 loops=1)

  • Output: cav1.contract_amend_version_id, cav2.contract_amend_version_id
  • Hash Cond: (cav1.contract_renew_version_id = cav2.contract_renew_version_id)
  • Join Filter: (cav2.create_timestamp < cav1.create_timestamp)
  • Rows Removed by Join Filter: 32398
  • Buffers: shared hit=570
31. 1.729 1.729 ↑ 1.0 18,396 1

Seq Scan on client_pinnacle.contract_amend_version cav1 (cost=0.00..468.96 rows=18,396 width=40) (actual time=0.008..1.729 rows=18,396 loops=1)

  • Output: cav1.contract_amend_version_id, cav1.contract_renew_version_id, cav1.contract_state, cav1.contract_amend_version_parent_id, cav1.contract_name, cav1.contact_name, cav1.contact_email, cav1.contact_phone, cav1.create_timestamp
  • Buffers: shared hit=285
32. 4.243 8.202 ↑ 1.0 18,396 1

Hash (cost=468.96..468.96 rows=18,396 width=40) (actual time=8.202..8.202 rows=18,396 loops=1)

  • Output: cav2.contract_amend_version_id, cav2.contract_renew_version_id, cav2.create_timestamp
  • Buckets: 32768 Batches: 1 Memory Usage: 1550kB
  • Buffers: shared hit=285
33. 3.959 3.959 ↑ 1.0 18,396 1

Seq Scan on client_pinnacle.contract_amend_version cav2 (cost=0.00..468.96 rows=18,396 width=40) (actual time=0.003..3.959 rows=18,396 loops=1)

  • Output: cav2.contract_amend_version_id, cav2.contract_renew_version_id, cav2.create_timestamp
  • Buffers: shared hit=285
34. 0.558 5.467 ↓ 5.7 609 1

Hash (cost=884.28..884.28 rows=106 width=299) (actual time=5.467..5.467 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_item.uom_type_id
  • Buckets: 1024 Batches: 1 Memory Usage: 206kB
  • Buffers: shared hit=4458
35. 0.289 4.909 ↓ 5.7 609 1

Nested Loop Left Join (cost=128.03..884.28 rows=106 width=299) (actual time=1.321..4.909 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type, product.product_name, product.product_number, company.company_name, company.company_number, contract_item.contract_id, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_direct_type, contract_item.rebate_deviated_type, contract_item.rebate_growth_decimal_model, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.rebate_direct_value, contract_item.rebate_deviated_value, contract_item.uom_type_id
  • Inner Unique: true
  • Buffers: shared hit=4458
36. 0.191 3.402 ↓ 5.7 609 1

Nested Loop Left Join (cost=127.61..521.14 rows=106 width=235) (actual time=1.299..3.402 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type, product.product_name, product.product_number, company.company_name, company.company_number
  • Inner Unique: true
  • Buffers: shared hit=2026
37. 0.275 1.993 ↓ 5.7 609 1

Hash Join (cost=127.32..297.07 rows=106 width=204) (actual time=1.287..1.993 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type, product.product_name, product.product_number
  • Inner Unique: true
  • Hash Cond: (claim_product.product_id = product.product_id)
  • Buffers: shared hit=198
38. 0.123 0.535 ↓ 5.7 609 1

Nested Loop (cost=1.69..171.16 rows=106 width=166) (actual time=0.072..0.535 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type
  • Buffers: shared hit=129
39. 0.002 0.059 ↑ 1.0 1 1

Nested Loop (cost=1.25..7.34 rows=1 width=24) (actual time=0.057..0.059 rows=1 loops=1)

  • Output: claim.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type
  • Inner Unique: true
  • Buffers: shared hit=13
40. 0.001 0.047 ↑ 1.0 1 1

Nested Loop (cost=1.12..7.18 rows=1 width=36) (actual time=0.046..0.047 rows=1 loops=1)

  • Output: claim.claim_id, claim.contract_sequence, claimant_company.company_type_id
  • Inner Unique: true
  • Buffers: shared hit=11
41. 0.003 0.033 ↑ 1.0 1 1

Nested Loop (cost=0.84..6.88 rows=1 width=36) (actual time=0.032..0.033 rows=1 loops=1)

  • Output: claim.claim_id, claim.contract_sequence, invoice.claimant_company_id
  • Inner Unique: true
  • Buffers: shared hit=8
42. 0.014 0.014 ↑ 1.0 1 1

Index Scan using claim_pkey on client_pinnacle.claim (cost=0.42..3.44 rows=1 width=36) (actual time=0.013..0.014 rows=1 loops=1)

  • Output: claim.claim_id, claim.invoice_id, claim.claim_state, claim.claim_sequence, claim.transaction_type, claim.contract_sequence, claim.claim_tag
  • Index Cond: (claim.claim_id = 'a9846f99-396a-4ce9-8035-ccd35769b080'::uuid)
  • Buffers: shared hit=4
43. 0.016 0.016 ↑ 1.0 1 1

Index Scan using invoice_pkey on client_pinnacle.invoice (cost=0.42..3.44 rows=1 width=32) (actual time=0.016..0.016 rows=1 loops=1)

  • Output: invoice.invoice_id, invoice.claimant_company_id
  • Index Cond: (invoice.invoice_id = claim.invoice_id)
  • Buffers: shared hit=4
44. 0.013 0.013 ↑ 1.0 1 1

Index Scan using company_pkey on client_pinnacle.company claimant_company (cost=0.29..0.31 rows=1 width=32) (actual time=0.013..0.013 rows=1 loops=1)

  • Output: claimant_company.company_id, claimant_company.client_id, claimant_company.company_name, claimant_company.company_number, claimant_company.company_type_id, claimant_company.active_ind, claimant_company.address_1, claimant_company.address_2, claimant_company.address_3, claimant_company.address_4, claimant_company.city, claimant_company.region, claimant_company.postal_code, claimant_company.country, claimant_company.company_agg_id, claimant_company.deduction_interval, claimant_company.alt_address_active, claimant_company.alt_address_1, claimant_company.alt_address_2, claimant_company.alt_address_3, claimant_company.alt_address_4, claimant_company.alt_city, claimant_company.alt_region, claimant_company.alt_postal_code, claimant_company.alt_country, claimant_company.atlas_company_id, claimant_company.email, claimant_company.tax_type_id, claimant_company.redistributor_ind, claimant_company.operator_request, claimant_company.early_payment_discount, claimant_company.vip
  • Index Cond: (claimant_company.company_id = invoice.claimant_company_id)
  • Buffers: shared hit=3
45. 0.010 0.010 ↑ 1.0 1 1

Index Scan using company_type_pkey on client_pinnacle.company_type claimant_company_type (cost=0.13..0.15 rows=1 width=20) (actual time=0.010..0.010 rows=1 loops=1)

  • Output: claimant_company_type.company_type_id, claimant_company_type.client_id, claimant_company_type.company_type_description, claimant_company_type.company_type_cd, claimant_company_type.active_ind, claimant_company_type.internal_company_type
  • Index Cond: (claimant_company_type.company_type_id = claimant_company.company_type_id)
  • Buffers: shared hit=2
46. 0.353 0.353 ↓ 5.7 609 1

Index Scan using claim_product_claim_id_idx on client_pinnacle.claim_product (cost=0.43..162.76 rows=106 width=158) (actual time=0.014..0.353 rows=609 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, claim_product.distributor_company_id, claim_product.uom_type_id, claim_product.rebate_calculated_rate, claim_product.rebate_requested_quantity, claim_product.rebate_requested_rate, claim_product.rebate_allowed_quantity, claim_product.rebate_allowed_rate, claim_product.resolve_date, claim_product.claimant_contract_name, claim_product.contract_item_id, claim_product.distributor_invoice_number, claim_product.claim_id
  • Index Cond: (claim_product.claim_id = 'a9846f99-396a-4ce9-8035-ccd35769b080'::uuid)
  • Buffers: shared hit=116
47. 0.649 1.183 ↑ 1.0 2,517 1

Hash (cost=94.17..94.17 rows=2,517 width=54) (actual time=1.183..1.183 rows=2,517 loops=1)

  • Output: product.product_name, product.product_number, product.product_id
  • Buckets: 4096 Batches: 1 Memory Usage: 247kB
  • Buffers: shared hit=69
48. 0.534 0.534 ↑ 1.0 2,517 1

Seq Scan on client_pinnacle.product (cost=0.00..94.17 rows=2,517 width=54) (actual time=0.008..0.534 rows=2,517 loops=1)

  • Output: product.product_name, product.product_number, product.product_id
  • Buffers: shared hit=69
49. 1.218 1.218 ↑ 1.0 1 609

Index Scan using company_pkey on client_pinnacle.company (cost=0.29..2.11 rows=1 width=47) (actual time=0.002..0.002 rows=1 loops=609)

  • 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: (claim_product.distributor_company_id = company.company_id)
  • Buffers: shared hit=1828
50. 1.218 1.218 ↑ 1.0 1 609

Index Scan using contract_item_pkey on client_pinnacle.contract_item (cost=0.42..3.43 rows=1 width=80) (actual time=0.002..0.002 rows=1 loops=609)

  • Output: contract_item.contract_item_id, contract_item.contract_id, contract_item.product_id, contract_item.grouping_id, contract_item.estimated_quantity, contract_item.uom_type_id, contract_item.rebate_deviated_value, contract_item.rebate_deviated_type, contract_item.inactive_override, contract_item.rebate_direct_value, contract_item.rebate_direct_type, contract_item.rebate_direct_decimal_model, contract_item.rebate_deviated_decimal_model, contract_item.won, contract_item.rebate_growth_type, contract_item.rebate_growth_decimal_model
  • Index Cond: (claim_product.contract_item_id = contract_item.contract_item_id)
  • Buffers: shared hit=2432
51. 1.827 1.827 ↑ 1.0 1 609

Index Scan using contract_family_unique on client_pinnacle.contract_family (cost=0.28..3.30 rows=1 width=54) (actual time=0.003..0.003 rows=1 loops=609)

  • Output: contract_family.contract_family_id, contract_family.client_id, contract_family.contractee_company_id, contract_family.contractee_grouping_id, contract_family.creator_id, contract_family.contract_sequence, contract_family.cost_basis_type, contract_family.contract_type, contract_family.contract_title, contract_family.contract_template_id, contract_family.payment_calendar_id, contract_family.catch_all, contract_family.import_contract_number, contract_family.accrual_quantity_source
  • Index Cond: (contract_family.contract_sequence = claim.contract_sequence)
  • Buffers: shared hit=1827
52. 1.218 6.090 ↑ 1.0 1 609

Nested Loop (cost=0.84..1.21 rows=1 width=20) (actual time=0.009..0.010 rows=1 loops=609)

  • Output: c.contract_family_id, ct.internal_company_type
  • Inner Unique: true
  • Buffers: shared hit=4872
53. 0.609 4.263 ↑ 1.0 1 609

Nested Loop Left Join (cost=0.71..0.92 rows=1 width=48) (actual time=0.006..0.007 rows=1 loops=609)

  • Output: c.contract_family_id, gc.company_type_id, cmp.company_type_id
  • Inner Unique: true
  • Buffers: shared hit=3654
54. 1.218 2.436 ↑ 1.0 1 609

Nested Loop Left Join (cost=0.42..0.54 rows=1 width=48) (actual time=0.003..0.004 rows=1 loops=609)

  • Output: c.contractee_company_id, c.contract_family_id, gc.company_type_id
  • Inner Unique: true
  • Buffers: shared hit=1827
55. 1.218 1.218 ↑ 1.0 1 609

Index Scan using contract_family_pkey on client_pinnacle.contract_family c (cost=0.28..0.38 rows=1 width=48) (actual time=0.002..0.002 rows=1 loops=609)

  • Output: c.contract_family_id, c.client_id, c.contractee_company_id, c.contractee_grouping_id, c.creator_id, c.contract_sequence, c.cost_basis_type, c.contract_type, c.contract_title, c.contract_template_id, c.payment_calendar_id, c.catch_all, c.import_contract_number, c.accrual_quantity_source
  • Index Cond: (contract_family.contract_family_id = c.contract_family_id)
  • Buffers: shared hit=1827
56. 0.000 0.000 ↓ 0.0 0 609

Index Scan using grouping_company_pkey on client_pinnacle.grouping_company gc (cost=0.14..0.16 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=609)

  • Output: gc.grouping_id, gc.client_id, gc.grouping_description, gc.grouping_cd, gc.grouping_type, gc.parent_grouping_id, gc.active_ind, gc.company_type_id, gc.grouping_company_type
  • Index Cond: (gc.grouping_id = c.contractee_grouping_id)
57. 1.218 1.218 ↑ 1.0 1 609

Index Scan using company_pkey on client_pinnacle.company cmp (cost=0.29..0.38 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=609)

  • Output: cmp.company_id, cmp.client_id, cmp.company_name, cmp.company_number, cmp.company_type_id, cmp.active_ind, cmp.address_1, cmp.address_2, cmp.address_3, cmp.address_4, cmp.city, cmp.region, cmp.postal_code, cmp.country, cmp.company_agg_id, cmp.deduction_interval, cmp.alt_address_active, cmp.alt_address_1, cmp.alt_address_2, cmp.alt_address_3, cmp.alt_address_4, cmp.alt_city, cmp.alt_region, cmp.alt_postal_code, cmp.alt_country, cmp.atlas_company_id, cmp.email, cmp.tax_type_id, cmp.redistributor_ind, cmp.operator_request, cmp.early_payment_discount, cmp.vip
  • Index Cond: (cmp.company_id = c.contractee_company_id)
  • Buffers: shared hit=1827
58. 0.609 0.609 ↑ 1.0 1 609

Index Scan using company_type_pkey on client_pinnacle.company_type ct (cost=0.13..0.24 rows=1 width=20) (actual time=0.001..0.001 rows=1 loops=609)

  • Output: ct.company_type_id, ct.client_id, ct.company_type_description, ct.company_type_cd, ct.active_ind, ct.internal_company_type
  • Index Cond: (ct.company_type_id = COALESCE(cmp.company_type_id, gc.company_type_id))
  • Buffers: shared hit=1218
59. 0.595 5.481 ↑ 1.0 1 609

Nested Loop (cost=0.84..1.26 rows=1 width=58) (actual time=0.008..0.009 rows=1 loops=609)

  • Output: pro.product_id, suomc.rate, suomc.uom_type_id, tuomc.rate, tuomc.uom_type_id
  • Join Filter: (claim_product.uom_type_id = tuomc.uom_type_id)
  • Rows Removed by Join Filter: 0
  • Buffers: shared hit=4894
60. 1.218 3.654 ↑ 1.0 1 609

Nested Loop (cost=0.56..0.92 rows=1 width=53) (actual time=0.005..0.006 rows=1 loops=609)

  • Output: pro.product_id, suomc.rate, suomc.product_id, suomc.uom_type_id
  • Buffers: shared hit=3046
61. 1.218 1.218 ↑ 1.0 1 609

Index Only Scan using product_pkey on client_pinnacle.product pro (cost=0.28..0.59 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=609)

  • Output: pro.product_id
  • Index Cond: (pro.product_id = claim_product.product_id)
  • Heap Fetches: 0
  • Buffers: shared hit=1219
62. 1.218 1.218 ↑ 1.0 1 609

Index Scan using product_uom_conversion_pkey on client_pinnacle.product_uom_conversion suomc (cost=0.28..0.32 rows=1 width=37) (actual time=0.002..0.002 rows=1 loops=609)

  • Output: suomc.product_id, suomc.uom_type_id, suomc.rate
  • Index Cond: (suomc.product_id = pro.product_id)
  • Buffers: shared hit=1827
63. 1.232 1.232 ↑ 1.0 1 616

Index Scan using product_uom_conversion_pkey on client_pinnacle.product_uom_conversion tuomc (cost=0.28..0.32 rows=1 width=37) (actual time=0.002..0.002 rows=1 loops=616)

  • Output: tuomc.product_id, tuomc.uom_type_id, tuomc.rate
  • Index Cond: (tuomc.product_id = pro.product_id)
  • Buffers: shared hit=1848
64. 0.609 0.609 ↑ 1.0 1 609

Result (cost=0.00..0.04 rows=1 width=24) (actual time=0.001..0.001 rows=1 loops=609)

  • Output: NULL::uuid, (CASE WHEN (contract_family.contract_type = ANY ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) THEN 'GROWTH'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'LOCATION'::enum.internal_company_type)) THEN 'DIRECT'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'LOCATION'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DEVIATED'::text WHEN ((contract_family.contract_type <> ALL ('{GROWTH_AUTOPAY,GROWTH_STANDARD}'::enum.contract_type[])) AND (ct.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type) AND (claimant_company_type.internal_company_type = 'DISTRIBUTOR'::enum.internal_company_type)) THEN 'DIRECT'::text ELSE NULL::text END)::enum.contract_rebate_method, NULL::enum.claim_product_contract_eligibility_type
65. 0.161 2.185 ↓ 5.7 609 1

Hash (cost=223.78..223.78 rows=106 width=64) (actual time=2.185..2.185 rows=609 loops=1)

  • Output: product_uom_conversions.uom_type_ids, product_uom_conversions.claim_product_id, product_uom_conversions.claim_id
  • Buckets: 1024 Batches: 1 Memory Usage: 69kB
  • Buffers: shared hit=1335
66. 0.078 2.024 ↓ 5.7 609 1

Subquery Scan on product_uom_conversions (cost=221.40..223.78 rows=106 width=64) (actual time=1.777..2.024 rows=609 loops=1)

  • Output: product_uom_conversions.uom_type_ids, product_uom_conversions.claim_product_id, product_uom_conversions.claim_id
  • Buffers: shared hit=1335
67. 0.675 1.946 ↓ 5.7 609 1

HashAggregate (cost=221.40..222.72 rows=106 width=64) (actual time=1.777..1.946 rows=609 loops=1)

  • Output: claim_product_2.claim_id, claim_product_2.claim_product_id, array_agg(product_uom_conversion.uom_type_id)
  • Group Key: claim_product_2.claim_product_id
  • Buffers: shared hit=1335
68. 0.382 1.271 ↓ 5.7 616 1

Nested Loop (cost=0.71..220.86 rows=108 width=48) (actual time=0.045..1.271 rows=616 loops=1)

  • Output: claim_product_2.claim_product_id, claim_product_2.claim_id, product_uom_conversion.uom_type_id
  • Buffers: shared hit=1335
69. 0.280 0.280 ↓ 5.7 609 1

Index Scan using claim_product_claim_id_idx on client_pinnacle.claim_product claim_product_2 (cost=0.43..162.76 rows=106 width=48) (actual time=0.029..0.280 rows=609 loops=1)

  • Output: claim_product_2.claim_id, claim_product_2.claim_product_id, claim_product_2.product_id
  • Index Cond: (claim_product_2.claim_id = 'a9846f99-396a-4ce9-8035-ccd35769b080'::uuid)
  • Buffers: shared hit=116
70. 0.609 0.609 ↑ 1.0 1 609

Index Only Scan using product_uom_conversion_pkey on client_pinnacle.product_uom_conversion (cost=0.28..0.54 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=609)

  • Output: product_uom_conversion.product_id, product_uom_conversion.uom_type_id
  • Index Cond: (product_uom_conversion.product_id = claim_product_2.product_id)
  • Heap Fetches: 0
  • Buffers: shared hit=1219
71. 0.609 8.526 ↓ 0.0 0 609

Nested Loop Left Join (cost=2.26..37.63 rows=1 width=68) (actual time=0.014..0.014 rows=0 loops=609)

  • Output: claim_product_1.claim_product_id, claim_product_1.claim_id, ('DEFAULT'::enum.price_tier), (CASE WHEN (pm.math_operation_value IS NULL) THEN price_default.price WHEN (pm.math_operation IS NULL) THEN price_default.price WHEN (pm.math_operation = 'ADD'::enum.math_operation) THEN (price_default.price + pm.math_operation_value) WHEN (pm.math_operation = 'SUBTRACT'::enum.math_operation) THEN (price_default.price - pm.math_operation_value) WHEN (pm.math_operation = 'MULTIPLY'::enum.math_operation) THEN (price_default.price * pm.math_operation_value) ELSE price_default.price END / (tuomc_1.rate / suomc_1.rate))
  • Buffers: shared hit=4270
72. 0.000 7.917 ↓ 0.0 0 609

Nested Loop (cost=1.98..37.31 rows=1 width=70) (actual time=0.013..0.013 rows=0 loops=609)

  • Output: claim_product_1.claim_product_id, claim_product_1.claim_id, ('DEFAULT'::enum.price_tier), price_default.price_id, price_default.price, suomc_1.rate, tuomc_1.rate
  • Inner Unique: true
  • Join Filter: ((pro_1.product_id = tuomc_1.product_id) AND (claim_product_1.uom_type_id = tuomc_1.uom_type_id))
  • Buffers: shared hit=4270
73. 0.609 7.917 ↓ 0.0 0 609

Nested Loop (cost=1.70..37.00 rows=1 width=129) (actual time=0.013..0.013 rows=0 loops=609)

  • Output: claim_product_1.claim_product_id, claim_product_1.uom_type_id, claim_product_1.claim_id, ('DEFAULT'::enum.price_tier), price_default.product_id, price_default.price_id, price_default.price, pro_1.product_id, suomc_1.product_id, suomc_1.rate
  • Inner Unique: true
  • Join Filter: (suomc_1.product_id = pro_1.product_id)
  • Buffers: shared hit=4270
74. 0.000 7.308 ↓ 0.0 0 609

Nested Loop (cost=1.42..36.69 rows=1 width=113) (actual time=0.012..0.012 rows=0 loops=609)

  • Output: claim_product_1.claim_product_id, claim_product_1.uom_type_id, claim_product_1.claim_id, ('DEFAULT'::enum.price_tier), price_default.product_id, price_default.price_id, price_default.price, suomc_1.product_id, suomc_1.rate
  • Inner Unique: true
  • Buffers: shared hit=4270
75. 0.000 7.308 ↓ 0.0 0 609

Nested Loop (cost=1.14..8.48 rows=94 width=108) (actual time=0.012..0.012 rows=0 loops=609)

  • Output: claim_product_1.claim_product_id, claim_product_1.uom_type_id, claim_product_1.claim_id, ('DEFAULT'::enum.price_tier), price_default.product_id, price_default.uom_type_id, price_default.price_id, price_default.price
  • Buffers: shared hit=4270
76. 1.218 7.308 ↓ 0.0 0 609

Nested Loop (cost=0.86..6.90 rows=1 width=64) (actual time=0.012..0.012 rows=0 loops=609)

  • Output: claim_product_1.claim_product_id, claim_product_1.uom_type_id, claim_product_1.claim_id, claim_product_price.price_id
  • Inner Unique: true
  • Buffers: shared hit=4270
77. 3.654 3.654 ↑ 1.0 1 609

Index Scan using claim_product_pkey on client_pinnacle.claim_product claim_product_1 (cost=0.43..3.46 rows=1 width=48) (actual time=0.006..0.006 rows=1 loops=609)

  • Output: claim_product_1.claim_product_id, claim_product_1.uom_type_id, claim_product_1.claim_id
  • Index Cond: (claim_product.claim_product_id = claim_product_1.claim_product_id)
  • Filter: ((claim_product_1.claim_id = 'a9846f99-396a-4ce9-8035-ccd35769b080'::uuid) AND (claim_product.claim_id = claim_product_1.claim_id))
  • Buffers: shared hit=2440
78. 2.436 2.436 ↓ 0.0 0 609

Index Scan using claim_product_price_unique on client_pinnacle.claim_product_price (cost=0.43..3.45 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=609)

  • Output: claim_product_price.claim_product_id, claim_product_price.price_id
  • Index Cond: (claim_product_price.claim_product_id = claim_product_1.claim_product_id)
  • Buffers: shared hit=1830
79. 0.000 0.000 ↓ 0.0 0

Append (cost=0.28..1.53 rows=5 width=60) (never executed)

80. 0.000 0.000 ↓ 0.0 0

Index Scan using price_default_pkey on client_pinnacle.price_default (cost=0.28..0.30 rows=1 width=58) (never executed)

  • Output: 'DEFAULT'::enum.price_tier, price_default.product_id, price_default.uom_type_id, price_default.price_id, price_default.price
  • Index Cond: (price_default.price_id = claim_product_price.price_id)
81. 0.000 0.000 ↓ 0.0 0

Index Scan using price_generated_pkey on client_pinnacle.price_sale (cost=0.43..0.47 rows=1 width=60) (never executed)

  • Output: 'SALE'::enum.price_tier, price_sale.product_id, price_sale.uom_type_id, price_sale.price_id, price_sale.price
  • Index Cond: (price_sale.price_id = claim_product_price.price_id)
82. 0.000 0.000 ↓ 0.0 0

Index Scan using price_company_pkey on client_pinnacle.price_company (cost=0.29..0.30 rows=1 width=58) (never executed)

  • Output: 'COMPANY'::enum.price_tier, price_company.product_id, price_company.uom_type_id, price_company.price_id, price_company.price
  • Index Cond: (price_company.price_id = claim_product_price.price_id)
83. 0.000 0.000 ↓ 0.0 0

Index Scan using price_list_pkey on client_pinnacle.price_list (cost=0.15..0.17 rows=1 width=84) (never executed)

  • Output: 'LIST'::enum.price_tier, price_list.product_id, price_list.uom_type_id, price_list.price_id, price_list.price
  • Index Cond: (price_list.price_id = claim_product_price.price_id)
84. 0.000 0.000 ↓ 0.0 0

Index Scan using price_class_pkey on client_pinnacle.price_class (cost=0.28..0.30 rows=1 width=58) (never executed)

  • Output: 'CLASS'::enum.price_tier, price_class.product_id, price_class.uom_type_id, price_class.price_id, price_class.price
  • Index Cond: (price_class.price_id = claim_product_price.price_id)
85. 0.000 0.000 ↓ 0.0 0

Index Scan using product_uom_conversion_pkey on client_pinnacle.product_uom_conversion suomc_1 (cost=0.28..0.30 rows=1 width=37) (never executed)

  • Output: suomc_1.product_id, suomc_1.uom_type_id, suomc_1.rate
  • Index Cond: ((suomc_1.product_id = price_default.product_id) AND (suomc_1.uom_type_id = price_default.uom_type_id))
86. 0.000 0.000 ↓ 0.0 0

Index Only Scan using product_pkey on client_pinnacle.product pro_1 (cost=0.28..0.30 rows=1 width=16) (never executed)

  • Output: pro_1.product_id
  • Index Cond: (pro_1.product_id = price_default.product_id)
  • Heap Fetches: 0
87. 0.000 0.000 ↓ 0.0 0

Index Scan using product_uom_conversion_pkey on client_pinnacle.product_uom_conversion tuomc_1 (cost=0.28..0.30 rows=1 width=37) (never executed)

  • Output: tuomc_1.product_id, tuomc_1.uom_type_id, tuomc_1.rate
  • Index Cond: (tuomc_1.product_id = price_default.product_id)
88. 0.000 0.000 ↓ 0.0 0

Index Scan using price_modified_excl on client_pinnacle.price_modified pm (cost=0.28..0.30 rows=1 width=27) (never executed)

  • Output: pm.price_id, pm.math_operation_value, pm.math_operation
  • Index Cond: (price_default.price_id = pm.price_id)
  • Filter: upper_inf(pm.active_range)
89. 0.609 3.045 ↓ 0.0 0 609

GroupAggregate (cost=398.81..400.39 rows=70 width=64) (actual time=0.005..0.005 rows=0 loops=609)

  • Output: claim_product_3.claim_id, claim_product_location.claim_product_id, string_agg(claim_product_location.distributor_invoice_number, ', '::text)
  • Group Key: claim_product_3.claim_id, claim_product_location.claim_product_id
  • Buffers: shared hit=2552
90. 0.000 2.436 ↓ 0.0 0 609

Sort (cost=398.81..398.99 rows=70 width=33) (actual time=0.004..0.004 rows=0 loops=609)

  • Output: claim_product_3.claim_id, claim_product_location.claim_product_id, claim_product_location.distributor_invoice_number
  • Sort Key: claim_product_location.claim_product_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=2552
91. 0.349 2.442 ↓ 0.0 0 1

Nested Loop (cost=0.99..396.67 rows=70 width=33) (actual time=2.442..2.442 rows=0 loops=1)

  • Output: claim_product_3.claim_id, claim_product_location.claim_product_id, claim_product_location.distributor_invoice_number
  • Buffers: shared hit=2552
92. 0.266 0.266 ↓ 5.7 609 1

Index Scan using claim_product_claim_id_idx on client_pinnacle.claim_product claim_product_3 (cost=0.43..162.76 rows=106 width=32) (actual time=0.026..0.266 rows=609 loops=1)

  • Output: claim_product_3.claim_id, claim_product_3.claim_product_id
  • Index Cond: (claim_product_3.claim_id = 'a9846f99-396a-4ce9-8035-ccd35769b080'::uuid)
  • Buffers: shared hit=116
93. 1.827 1.827 ↓ 0.0 0 609

Index Only Scan using claim_product_location_pkey on client_pinnacle.claim_product_location (cost=0.56..2.16 rows=5 width=17) (actual time=0.003..0.003 rows=0 loops=609)

  • Output: claim_product_location.claim_product_id, claim_product_location.location_id, claim_product_location.distributor_invoice_number
  • Index Cond: (claim_product_location.claim_product_id = claim_product_3.claim_product_id)
  • Heap Fetches: 0
  • Buffers: shared hit=2436
94. 51.765 188.181 ↓ 609.0 609 609

Subquery Scan on cpo (cost=0.42..6.69 rows=1 width=40) (actual time=0.075..0.309 rows=609 loops=609)

  • Output: cpo.claim_id, cpo.claim_product_id, cpo.display_order
  • Filter: (cpo.claim_id = 'a9846f99-396a-4ce9-8035-ccd35769b080'::uuid)
  • Buffers: shared hit=4872
95. 54.810 136.416 ↓ 6.1 609 609

Nested Loop (cost=0.42..5.44 rows=100 width=40) (actual time=0.075..0.224 rows=609 loops=609)

  • Output: claim_product_order.claim_id, cpo_1.claim_product_id, cpo_1.display_order
  • Buffers: shared hit=4872
96. 1.827 1.827 ↑ 1.0 1 609

Index Scan using claim_product_order_pkey on client_pinnacle.claim_product_order (cost=0.42..3.44 rows=1 width=143) (actual time=0.003..0.003 rows=1 loops=609)

  • Output: claim_product_order.claim_id, claim_product_order.item_ids
  • Index Cond: (claim_product_order.claim_id = 'a9846f99-396a-4ce9-8035-ccd35769b080'::uuid)
  • Buffers: shared hit=2436
97. 79.779 79.779 ↓ 6.1 609 609

Function Scan on pg_catalog.unnest cpo_1 (cost=0.00..1.00 rows=100 width=24) (actual time=0.065..0.131 rows=609 loops=609)

  • Output: cpo_1.claim_product_id, cpo_1.display_order
  • Function Call: unnest(claim_product_order.item_ids)
  • Buffers: shared hit=2436