explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bgWj

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 9.058 ↑ 7.6 5 1

Subquery Scan on claim_select_product (cost=712.26..712.73 rows=38 width=472) (actual time=9.054..9.058 rows=5 loops=1)

  • Output: claim_select_product.claim_product_id, claim_select_product.product_id, claim_select_product.product_name, claim_select_product.product_number, claim_select_product.uom_type_ids, claim_select_product.distributor_company_id, claim_select_product.distributor_company_name, claim_select_product.distributor_company_number, claim_select_product.uom_type_id, claim_select_product.rebate_calculated_rate, claim_select_product.rebate_requested_quantity, claim_select_product.rebate_requested_rate, claim_select_product.rebate_allowed_quantity, claim_select_product.rebate_allowed_rate, claim_select_product.price, claim_select_product.price_tier, claim_select_product.resolve_date, claim_select_product.claimant_contract_name, claim_select_product.contract_item_id, claim_select_product.contract_id, claim_select_product.contract_title, claim_select_product.contract_version_id, claim_select_product.won, claim_select_product.rebate_method, claim_select_product.rebate_value_type, claim_select_product.rebate_decimal_model, claim_select_product.rebate_value, claim_select_product.distributor_invoice_number, claim_select_product.display_order
  • Buffers: shared hit=261
2. 0.025 9.050 ↑ 7.6 5 1

Sort (cost=712.26..712.35 rows=38 width=480) (actual time=9.050..9.050 rows=5 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, ((product.product_name)::text), ((product.product_number)::text), (array_agg(product_uom_conversion.uom_type_id)), claim_product.distributor_company_id, ((company.company_name)::text), ((company.company_number)::text), 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.rate / suomc.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)::text), ((((((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_1.rate / suomc_1.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_1.rate / suomc_1.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_1.rate / suomc_1.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_1.rate / suomc_1.rate)) ELSE NULL::numeric END ELSE NULL::numeric END ELSE NULL::numeric END), (COALESCE(claim_product.distributor_invoice_number, cpl.distributor_invoice_number)), ((cpo.display_order)::integer), cpo.display_order
  • Sort Key: cpo.display_order
  • Sort Method: quicksort Memory: 27kB
  • Buffers: shared hit=261
3. 0.043 9.025 ↑ 7.6 5 1

Hash Left Join (cost=234.47..711.26 rows=38 width=480) (actual time=6.915..9.025 rows=5 loops=1)

  • Output: claim_product.claim_product_id, claim_product.product_id, product.product_name, product.product_number, (array_agg(product_uom_conversion.uom_type_id)), 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.rate / suomc.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_1.rate / suomc_1.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_1.rate / suomc_1.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_1.rate / suomc_1.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_1.rate / suomc_1.rate)) ELSE NULL::numeric END ELSE NULL::numeric END ELSE NULL::numeric END, COALESCE(claim_product.distributor_invoice_number, cpl.distributor_invoice_number), (cpo.display_order)::integer, cpo.display_order
  • Inner Unique: true
  • Hash Cond: ((claim_product.claim_id = cpl.claim_id) AND (claim_product.claim_product_id = cpl.claim_product_id))
  • Buffers: shared hit=261
4. 0.010 8.920 ↑ 7.6 5 1

Nested Loop Left Join (cost=219.24..692.21 rows=38 width=365) (actual time=6.831..8.920 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), 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_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version, ('DEFAULT'::enum.price_tier), contract_family.contract_title, suomc_1.rate, tuomc_1.rate, cpo.display_order, ((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 (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.rate / suomc.rate)))
  • Buffers: shared hit=247
5. 0.205 8.890 ↑ 7.6 5 1

Nested Loop Left Join (cost=219.24..689.93 rows=38 width=373) (actual time=6.817..8.890 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), 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_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version, ('DEFAULT'::enum.price_tier), contract_family.contract_title, contract_family.contract_type, suomc_1.rate, tuomc_1.rate, cpo.display_order, ct.internal_company_type, ((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.rate / suomc.rate)))
  • Join Filter: (contract_family.contract_family_id = c.contract_family_id)
  • Rows Removed by Join Filter: 1025
  • Buffers: shared hit=247
6. 0.018 7.980 ↑ 7.6 5 1

Hash Left Join (cost=200.25..656.08 rows=38 width=385) (actual time=6.202..7.980 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), 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_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version, ('DEFAULT'::enum.price_tier), contract_family.contract_title, contract_family.contract_type, contract_family.contract_family_id, suomc_1.rate, tuomc_1.rate, cpo.display_order, ((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.rate / suomc.rate)))
  • Hash Cond: ((claim_product.claim_id = claim_product_order.claim_id) AND (claim_product.claim_product_id = cpo.claim_product_id))
  • Buffers: shared hit=230
7. 0.009 7.899 ↑ 7.6 5 1

Nested Loop Left Join (cost=193.58..649.12 rows=38 width=377) (actual time=6.127..7.899 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), 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_1.contract_sequence, contract_renew_version_view.contract_renew_version, contract_amend_version_view.contract_amend_version, ('DEFAULT'::enum.price_tier), contract_family.contract_title, contract_family.contract_type, contract_family.contract_family_id, suomc_1.rate, tuomc_1.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.rate / suomc.rate)))
  • Join Filter: (contract_item.uom_type_id = suomc_1.uom_type_id)
  • Rows Removed by Join Filter: 1
  • Buffers: shared hit=228
8. 0.022 7.800 ↑ 7.6 5 1

Hash Left Join (cost=192.75..555.10 rows=38 width=383) (actual time=6.102..7.800 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), 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, ('DEFAULT'::enum.price_tier), contract_family.contract_title, contract_family.contract_type, contract_family.contract_family_id, ((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.rate / suomc.rate)))
  • Inner Unique: true
  • Hash Cond: (claim.contract_sequence = contract_family.contract_sequence)
  • Buffers: shared hit=181
9. 0.014 7.608 ↑ 7.6 5 1

Nested Loop Left Join (cost=182.11..544.37 rows=38 width=352) (actual time=5.917..7.608 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), 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, ('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.rate / suomc.rate)))
  • Join Filter: (claim_product.uom_type_id = tuomc.uom_type_id)
  • Rows Removed by Join Filter: 1
  • Buffers: shared hit=175
10. 0.030 7.379 ↑ 7.6 5 1

Hash Left Join (cost=181.01..317.54 rows=38 width=332) (actual time=5.825..7.379 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), company.company_name, company.company_number, claim_product_price.price_id, 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_item.contract_id = contract_amend_version.contract_amend_version_id)
  • Buffers: shared hit=122
11. 0.021 4.462 ↑ 7.6 5 1

Hash Left Join (cost=79.09..215.10 rows=38 width=312) (actual time=2.927..4.462 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), company.company_name, company.company_number, claim_product_price.price_id, 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
  • Hash Cond: (claim_product.contract_item_id = contract_item.contract_item_id)
  • Buffers: shared hit=92
12. 0.011 3.199 ↑ 7.6 5 1

Nested Loop (cost=23.04..158.95 rows=38 width=247) (actual time=1.672..3.199 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), company.company_name, company.company_number, claim_product_price.price_id
  • Inner Unique: true
  • Join Filter: (claim_product.product_id = product.product_id)
  • Buffers: shared hit=60
13. 0.010 3.153 ↑ 7.6 5 1

Nested Loop (cost=22.76..145.08 rows=38 width=234) (actual time=1.662..3.153 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), product_uom_conversion.product_id, company.company_name, company.company_number, claim_product_price.price_id
  • Buffers: shared hit=45
14. 0.292 3.098 ↑ 7.6 5 1

Merge Join (cost=21.80..137.52 rows=38 width=226) (actual time=1.619..3.098 rows=5 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, (array_agg(product_uom_conversion.uom_type_id)), product_uom_conversion.product_id, company.company_name, company.company_number, claim_product_price.price_id
  • Inner Unique: true
  • Merge Cond: (claim_product.product_id = product_uom_conversion.product_id)
  • Buffers: shared hit=34
15. 0.019 0.147 ↓ 1.2 5 1

Sort (cost=21.52..21.53 rows=4 width=178) (actual time=0.145..0.147 rows=5 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, company.company_name, company.company_number, claim_product_price.price_id
  • Sort Key: claim_product.product_id
  • Sort Method: quicksort Memory: 26kB
  • Buffers: shared hit=20
16. 0.007 0.128 ↓ 1.2 5 1

Nested Loop Left Join (cost=7.90..21.48 rows=4 width=178) (actual time=0.081..0.128 rows=5 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, company.company_name, company.company_number, claim_product_price.price_id
  • Inner Unique: true
  • Buffers: shared hit=20
17. 0.037 0.101 ↓ 1.2 5 1

Hash Right Join (cost=7.63..9.80 rows=4 width=155) (actual time=0.068..0.101 rows=5 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_product_price.price_id
  • Inner Unique: true
  • Hash Cond: (claim_product_price.claim_product_id = claim_product.claim_product_id)
  • Buffers: shared hit=5
18. 0.023 0.023 ↑ 1.0 93 1

Seq Scan on client_demo.claim_product_price (cost=0.00..1.93 rows=93 width=32) (actual time=0.011..0.023 rows=93 loops=1)

  • Output: claim_product_price.claim_product_id, claim_product_price.price_id
  • Buffers: shared hit=1
19. 0.008 0.041 ↓ 1.2 5 1

Hash (cost=7.58..7.58 rows=4 width=139) (actual time=0.041..0.041 rows=5 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
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=4
20. 0.016 0.033 ↓ 1.2 5 1

Bitmap Heap Scan on client_demo.claim_product (cost=1.82..7.58 rows=4 width=139) (actual time=0.027..0.033 rows=5 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
  • Recheck Cond: (claim_product.claim_id = 'ba48e7a1-d9c0-4c0e-a459-175a511c11ce'::uuid)
  • Heap Blocks: exact=2
  • Buffers: shared hit=4
21. 0.017 0.017 ↓ 1.2 5 1

Bitmap Index Scan on claim_product_claim_id_idx (cost=0.00..1.81 rows=4 width=0) (actual time=0.017..0.017 rows=5 loops=1)

  • Index Cond: (claim_product.claim_id = 'ba48e7a1-d9c0-4c0e-a459-175a511c11ce'::uuid)
  • Buffers: shared hit=2
22. 0.020 0.020 ↑ 1.0 1 5

Index Scan using company_pkey on client_demo.company (cost=0.27..2.92 rows=1 width=39) (actual time=0.004..0.004 rows=1 loops=5)

  • 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=15
23. 2.166 2.659 ↑ 1.1 1,793 1

GroupAggregate (cost=0.28..90.41 rows=2,015 width=48) (actual time=0.028..2.659 rows=1,793 loops=1)

  • Output: product_uom_conversion.product_id, array_agg(product_uom_conversion.uom_type_id)
  • Group Key: product_uom_conversion.product_id
  • Buffers: shared hit=14
24. 0.493 0.493 ↑ 1.1 1,888 1

Index Only Scan using product_uom_conversion_pkey on client_demo.product_uom_conversion (cost=0.28..54.61 rows=2,122 width=32) (actual time=0.017..0.493 rows=1,888 loops=1)

  • Output: product_uom_conversion.product_id, product_uom_conversion.uom_type_id
  • Heap Fetches: 0
  • Buffers: shared hit=14
25. 0.005 0.045 ↑ 1.0 1 5

Materialize (cost=0.96..7.10 rows=1 width=24) (actual time=0.008..0.009 rows=1 loops=5)

  • Output: claim.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type
  • Buffers: shared hit=11
26. 0.003 0.040 ↑ 1.0 1 1

Nested Loop (cost=0.96..7.09 rows=1 width=24) (actual time=0.037..0.040 rows=1 loops=1)

  • Output: claim.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type
  • Inner Unique: true
  • Buffers: shared hit=11
27. 0.002 0.030 ↑ 1.0 1 1

Nested Loop (cost=0.82..6.92 rows=1 width=36) (actual time=0.028..0.030 rows=1 loops=1)

  • Output: claim.claim_id, claim.contract_sequence, claimant_company.company_type_id
  • Inner Unique: true
  • Buffers: shared hit=9
28. 0.003 0.024 ↑ 1.0 1 1

Nested Loop (cost=0.55..6.60 rows=1 width=36) (actual time=0.022..0.024 rows=1 loops=1)

  • Output: claim.claim_id, claim.contract_sequence, invoice.claimant_company_id
  • Inner Unique: true
  • Buffers: shared hit=6
29. 0.012 0.012 ↑ 1.0 1 1

Index Scan using claim_pkey on client_demo.claim (cost=0.28..3.29 rows=1 width=36) (actual time=0.010..0.012 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 = 'ba48e7a1-d9c0-4c0e-a459-175a511c11ce'::uuid)
  • Buffers: shared hit=3
30. 0.009 0.009 ↑ 1.0 1 1

Index Scan using invoice_pkey on client_demo.invoice (cost=0.28..3.29 rows=1 width=32) (actual time=0.009..0.009 rows=1 loops=1)

  • Output: invoice.invoice_id, invoice.claimant_company_id
  • Index Cond: (invoice.invoice_id = claim.invoice_id)
  • Buffers: shared hit=3
31. 0.004 0.004 ↑ 1.0 1 1

Index Scan using company_pkey on client_demo.company claimant_company (cost=0.27..0.32 rows=1 width=32) (actual time=0.004..0.004 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
32. 0.007 0.007 ↑ 1.0 1 1

Index Scan using company_type_pkey on client_demo.company_type claimant_company_type (cost=0.14..0.17 rows=1 width=20) (actual time=0.007..0.007 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
33. 0.035 0.035 ↑ 1.0 1 5

Index Scan using product_pkey on client_demo.product (cost=0.28..0.35 rows=1 width=45) (actual time=0.007..0.007 rows=1 loops=5)

  • Output: product.product_id, product.client_id, product.product_name, product.product_number, product.gtin_number, product.brand_name, product.active_ind, product.default_uom_type_id, product.pack, product.size, product.size_uom, product.pack_size_size_uom, product.upc_number, product.reporting_visibility_ind, product.private_label_grouping_id
  • Index Cond: (product.product_id = product_uom_conversion.product_id)
  • Buffers: shared hit=15
34. 0.645 1.242 ↑ 1.0 1,069 1

Hash (cost=42.69..42.69 rows=1,069 width=81) (actual time=1.242..1.242 rows=1,069 loops=1)

  • Output: 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.contract_item_id, contract_item.uom_type_id
  • Buckets: 2048 Batches: 1 Memory Usage: 138kB
  • Buffers: shared hit=32
35. 0.597 0.597 ↑ 1.0 1,069 1

Seq Scan on client_demo.contract_item (cost=0.00..42.69 rows=1,069 width=81) (actual time=0.010..0.597 rows=1,069 loops=1)

  • Output: 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.contract_item_id, contract_item.uom_type_id
  • Buffers: shared hit=32
36. 0.123 2.887 ↑ 1.0 290 1

Hash (cost=98.29..98.29 rows=290 width=36) (actual time=2.886..2.887 rows=290 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
  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
  • Buffers: shared hit=30
37. 0.161 2.764 ↑ 1.0 290 1

Hash Join (cost=87.31..98.29 rows=290 width=36) (actual time=2.128..2.764 rows=290 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=30
38. 0.153 1.640 ↑ 1.0 290 1

Hash Join (cost=49.24..59.46 rows=290 width=28) (actual time=1.155..1.640 rows=290 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=20
39. 0.147 0.702 ↑ 1.0 290 1

Hash Join (cost=19.17..28.61 rows=290 width=52) (actual time=0.359..0.702 rows=290 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=14
40. 0.163 0.390 ↑ 1.0 290 1

Hash Join (cost=8.54..17.21 rows=290 width=64) (actual time=0.185..0.390 rows=290 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=8
41. 0.055 0.055 ↑ 1.0 290 1

Seq Scan on client_demo.contract_amend_version (cost=0.00..7.90 rows=290 width=32) (actual time=0.004..0.055 rows=290 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=5
42. 0.093 0.172 ↑ 1.0 246 1

Hash (cost=5.46..5.46 rows=246 width=32) (actual time=0.172..0.172 rows=246 loops=1)

  • Output: contract_renew_version.contract_family_id, contract_renew_version.contract_renew_version_id
  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
  • Buffers: shared hit=3
43. 0.079 0.079 ↑ 1.0 246 1

Seq Scan on client_demo.contract_renew_version (cost=0.00..5.46 rows=246 width=32) (actual time=0.005..0.079 rows=246 loops=1)

  • Output: contract_renew_version.contract_family_id, contract_renew_version.contract_renew_version_id
  • Buffers: shared hit=3
44. 0.077 0.165 ↑ 1.0 206 1

Hash (cost=8.06..8.06 rows=206 width=20) (actual time=0.165..0.165 rows=206 loops=1)

  • Output: contract_family_1.contract_sequence, contract_family_1.contract_family_id
  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
  • Buffers: shared hit=6
45. 0.088 0.088 ↑ 1.0 206 1

Seq Scan on client_demo.contract_family contract_family_1 (cost=0.00..8.06 rows=206 width=20) (actual time=0.008..0.088 rows=206 loops=1)

  • Output: contract_family_1.contract_sequence, contract_family_1.contract_family_id
  • Buffers: shared hit=6
46. 0.103 0.785 ↑ 1.0 246 1

Hash (cost=27.00..27.00 rows=246 width=24) (actual time=0.785..0.785 rows=246 loops=1)

  • Output: contract_renew_version_view.contract_renew_version, contract_renew_version_view.contract_renew_version_id
  • Buckets: 1024 Batches: 1 Memory Usage: 22kB
  • Buffers: shared hit=6
47. 0.055 0.682 ↑ 1.0 246 1

Subquery Scan on contract_renew_version_view (cost=22.08..27.00 rows=246 width=24) (actual time=0.550..0.682 rows=246 loops=1)

  • Output: contract_renew_version_view.contract_renew_version, contract_renew_version_view.contract_renew_version_id
  • Buffers: shared hit=6
48. 0.219 0.627 ↑ 1.0 246 1

HashAggregate (cost=22.08..24.54 rows=246 width=24) (actual time=0.549..0.627 rows=246 loops=1)

  • Output: crv1.contract_renew_version_id, count(crv2.contract_renew_version_id)
  • Group Key: crv1.contract_renew_version_id
  • Buffers: shared hit=6
49. 0.199 0.408 ↓ 1.1 271 1

Hash Left Join (cost=8.54..20.85 rows=246 width=32) (actual time=0.206..0.408 rows=271 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: 311
  • Buffers: shared hit=6
50. 0.040 0.040 ↑ 1.0 246 1

Seq Scan on client_demo.contract_renew_version crv1 (cost=0.00..5.46 rows=246 width=40) (actual time=0.004..0.040 rows=246 loops=1)

  • Output: crv1.contract_renew_version_id, crv1.contract_family_id, crv1.date_range, crv1.create_timestamp, crv1.dead
  • Buffers: shared hit=3
51. 0.097 0.169 ↑ 1.0 246 1

Hash (cost=5.46..5.46 rows=246 width=40) (actual time=0.169..0.169 rows=246 loops=1)

  • Output: crv2.contract_renew_version_id, crv2.contract_family_id, crv2.create_timestamp
  • Buckets: 1024 Batches: 1 Memory Usage: 26kB
  • Buffers: shared hit=3
52. 0.072 0.072 ↑ 1.0 246 1

Seq Scan on client_demo.contract_renew_version crv2 (cost=0.00..5.46 rows=246 width=40) (actual time=0.005..0.072 rows=246 loops=1)

  • Output: crv2.contract_renew_version_id, crv2.contract_family_id, crv2.create_timestamp
  • Buffers: shared hit=3
53. 0.099 0.963 ↑ 1.0 290 1

Hash (cost=34.44..34.44 rows=290 width=24) (actual time=0.963..0.963 rows=290 loops=1)

  • Output: contract_amend_version_view.contract_amend_version, contract_amend_version_view.contract_amend_version_id
  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
  • Buffers: shared hit=10
54. 0.071 0.864 ↑ 1.0 290 1

Subquery Scan on contract_amend_version_view (cost=28.64..34.44 rows=290 width=24) (actual time=0.708..0.864 rows=290 loops=1)

  • Output: contract_amend_version_view.contract_amend_version, contract_amend_version_view.contract_amend_version_id
  • Buffers: shared hit=10
55. 0.258 0.793 ↑ 1.0 290 1

HashAggregate (cost=28.64..31.54 rows=290 width=24) (actual time=0.707..0.793 rows=290 loops=1)

  • Output: cav1.contract_amend_version_id, count(cav2.contract_amend_version_id)
  • Group Key: cav1.contract_amend_version_id
  • Buffers: shared hit=10
56. 0.245 0.535 ↓ 1.1 310 1

Hash Left Join (cost=11.53..27.19 rows=290 width=32) (actual time=0.251..0.535 rows=310 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: 354
  • Buffers: shared hit=10
57. 0.056 0.056 ↑ 1.0 290 1

Seq Scan on client_demo.contract_amend_version cav1 (cost=0.00..7.90 rows=290 width=40) (actual time=0.009..0.056 rows=290 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=5
58. 0.115 0.234 ↑ 1.0 290 1

Hash (cost=7.90..7.90 rows=290 width=40) (actual time=0.234..0.234 rows=290 loops=1)

  • Output: cav2.contract_amend_version_id, cav2.contract_renew_version_id, cav2.create_timestamp
  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
  • Buffers: shared hit=5
59. 0.119 0.119 ↑ 1.0 290 1

Seq Scan on client_demo.contract_amend_version cav2 (cost=0.00..7.90 rows=290 width=40) (actual time=0.004..0.119 rows=290 loops=1)

  • Output: cav2.contract_amend_version_id, cav2.contract_renew_version_id, cav2.create_timestamp
  • Buffers: shared hit=5
60. 0.018 0.215 ↑ 1.0 1 5

Nested Loop Left Join (cost=1.10..5.96 rows=1 width=68) (actual time=0.029..0.043 rows=1 loops=5)

  • Output: ('DEFAULT'::enum.price_tier), price_default.price_id, tuomc.uom_type_id, (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.rate / suomc.rate))
  • Buffers: shared hit=53
61. 0.013 0.165 ↑ 1.0 1 5

Nested Loop (cost=0.98..5.78 rows=1 width=59) (actual time=0.021..0.033 rows=1 loops=5)

  • Output: ('DEFAULT'::enum.price_tier), price_default.price_id, price_default.price, suomc.rate, tuomc.uom_type_id, tuomc.rate
  • Join Filter: (pro.product_id = tuomc.product_id)
  • Buffers: shared hit=47
62. 0.008 0.140 ↑ 1.0 1 5

Nested Loop (cost=0.70..5.46 rows=1 width=86) (actual time=0.017..0.028 rows=1 loops=5)

  • Output: ('DEFAULT'::enum.price_tier), price_default.product_id, price_default.price_id, price_default.price, pro.product_id, suomc.product_id, suomc.rate
  • Inner Unique: true
  • Buffers: shared hit=37
63. 0.014 0.120 ↑ 1.0 1 5

Nested Loop (cost=0.42..5.16 rows=1 width=70) (actual time=0.013..0.024 rows=1 loops=5)

  • Output: ('DEFAULT'::enum.price_tier), price_default.product_id, price_default.price_id, price_default.price, suomc.product_id, suomc.rate
  • Inner Unique: true
  • Buffers: shared hit=30
64. 0.020 0.085 ↑ 5.0 1 5

Append (cost=0.14..3.62 rows=5 width=65) (actual time=0.006..0.017 rows=1 loops=5)

  • Buffers: shared hit=21
65. 0.025 0.025 ↑ 1.0 1 5

Index Scan using price_default_pkey on client_demo.price_default (cost=0.14..0.21 rows=1 width=57) (actual time=0.005..0.005 rows=1 loops=5)

  • Output: 'DEFAULT'::enum.price_tier, price_default.product_id, price_default.uom_type_id, price_default.price_id, price_default.price
  • Index Cond: (claim_product_price.price_id = price_default.price_id)
  • Buffers: shared hit=6
66. 0.015 0.015 ↓ 0.0 0 5

Index Scan using price_generated_pkey on client_demo.price_sale (cost=0.28..2.69 rows=1 width=64) (actual time=0.003..0.003 rows=0 loops=5)

  • Output: 'SALE'::enum.price_tier, price_sale.product_id, price_sale.uom_type_id, price_sale.price_id, price_sale.price
  • Index Cond: (claim_product_price.price_id = price_sale.price_id)
  • Buffers: shared hit=6
67. 0.010 0.010 ↓ 0.0 0 5

Index Scan using price_company_pkey on client_demo.price_company (cost=0.13..0.19 rows=1 width=59) (actual time=0.002..0.002 rows=0 loops=5)

  • Output: 'COMPANY'::enum.price_tier, price_company.product_id, price_company.uom_type_id, price_company.price_id, price_company.price
  • Index Cond: (claim_product_price.price_id = price_company.price_id)
  • Buffers: shared hit=3
68. 0.010 0.010 ↓ 0.0 0 5

Index Scan using price_list_pkey on client_demo.price_list (cost=0.12..0.19 rows=1 width=59) (actual time=0.002..0.002 rows=0 loops=5)

  • Output: 'LIST'::enum.price_tier, price_list.product_id, price_list.uom_type_id, price_list.price_id, price_list.price
  • Index Cond: (claim_product_price.price_id = price_list.price_id)
  • Buffers: shared hit=3
69. 0.005 0.005 ↓ 0.0 0 5

Index Scan using price_class_pkey on client_demo.price_class (cost=0.15..0.34 rows=1 width=84) (actual time=0.001..0.001 rows=0 loops=5)

  • Output: 'CLASS'::enum.price_tier, price_class.product_id, price_class.uom_type_id, price_class.price_id, price_class.price
  • Index Cond: (claim_product_price.price_id = price_class.price_id)
  • Buffers: shared hit=3
70. 0.021 0.021 ↑ 1.0 1 3

Index Scan using product_uom_conversion_pkey on client_demo.product_uom_conversion suomc (cost=0.28..0.31 rows=1 width=37) (actual time=0.006..0.007 rows=1 loops=3)

  • Output: suomc.product_id, suomc.uom_type_id, suomc.rate
  • Index Cond: ((suomc.product_id = price_default.product_id) AND (suomc.uom_type_id = price_default.uom_type_id))
  • Buffers: shared hit=9
71. 0.012 0.012 ↑ 1.0 1 3

Index Only Scan using product_pkey on client_demo.product pro (cost=0.28..0.31 rows=1 width=16) (actual time=0.004..0.004 rows=1 loops=3)

  • Output: pro.product_id
  • Index Cond: (pro.product_id = suomc.product_id)
  • Heap Fetches: 0
  • Buffers: shared hit=7
72. 0.012 0.012 ↑ 1.0 1 3

Index Scan using product_uom_conversion_pkey on client_demo.product_uom_conversion tuomc (cost=0.28..0.30 rows=1 width=37) (actual time=0.003..0.004 rows=1 loops=3)

  • Output: tuomc.product_id, tuomc.uom_type_id, tuomc.rate
  • Index Cond: (tuomc.product_id = price_default.product_id)
  • Buffers: shared hit=10
73. 0.032 0.032 ↓ 0.0 0 4

Index Scan using price_modified_excl on client_demo.price_modified pm (cost=0.12..0.15 rows=1 width=25) (actual time=0.008..0.008 rows=0 loops=4)

  • 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)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=6
74. 0.084 0.170 ↑ 1.0 206 1

Hash (cost=8.06..8.06 rows=206 width=39) (actual time=0.170..0.170 rows=206 loops=1)

  • Output: contract_family.contract_title, contract_family.contract_type, contract_family.contract_sequence, contract_family.contract_family_id
  • Buckets: 1024 Batches: 1 Memory Usage: 23kB
  • Buffers: shared hit=6
75. 0.086 0.086 ↑ 1.0 206 1

Seq Scan on client_demo.contract_family (cost=0.00..8.06 rows=206 width=39) (actual time=0.007..0.086 rows=206 loops=1)

  • Output: contract_family.contract_title, contract_family.contract_type, contract_family.contract_sequence, contract_family.contract_family_id
  • Buffers: shared hit=6
76. 0.016 0.090 ↑ 1.0 1 5

Nested Loop (cost=0.84..2.46 rows=1 width=58) (actual time=0.013..0.018 rows=1 loops=5)

  • Output: pro_1.product_id, suomc_1.rate, suomc_1.uom_type_id, tuomc_1.rate, tuomc_1.uom_type_id
  • Join Filter: (claim_product.uom_type_id = tuomc_1.uom_type_id)
  • Rows Removed by Join Filter: 0
  • Buffers: shared hit=47
77. 0.010 0.050 ↑ 1.0 1 5

Nested Loop (cost=0.56..2.13 rows=1 width=53) (actual time=0.009..0.010 rows=1 loops=5)

  • Output: pro_1.product_id, suomc_1.rate, suomc_1.product_id, suomc_1.uom_type_id
  • Buffers: shared hit=27
78. 0.020 0.020 ↑ 1.0 1 5

Index Only Scan using product_pkey on client_demo.product pro_1 (cost=0.28..1.80 rows=1 width=16) (actual time=0.003..0.004 rows=1 loops=5)

  • Output: pro_1.product_id
  • Index Cond: (pro_1.product_id = claim_product.product_id)
  • Heap Fetches: 0
  • Buffers: shared hit=11
79. 0.020 0.020 ↑ 1.0 1 5

Index Scan using product_uom_conversion_pkey on client_demo.product_uom_conversion suomc_1 (cost=0.28..0.32 rows=1 width=37) (actual time=0.004..0.004 rows=1 loops=5)

  • Output: suomc_1.product_id, suomc_1.uom_type_id, suomc_1.rate
  • Index Cond: (suomc_1.product_id = pro_1.product_id)
  • Buffers: shared hit=16
80. 0.024 0.024 ↑ 1.0 1 6

Index Scan using product_uom_conversion_pkey on client_demo.product_uom_conversion tuomc_1 (cost=0.28..0.32 rows=1 width=37) (actual time=0.003..0.004 rows=1 loops=6)

  • Output: tuomc_1.product_id, tuomc_1.uom_type_id, tuomc_1.rate
  • Index Cond: (tuomc_1.product_id = pro_1.product_id)
  • Buffers: shared hit=20
81. 0.004 0.063 ↑ 20.0 5 1

Hash (cost=5.17..5.17 rows=100 width=40) (actual time=0.063..0.063 rows=5 loops=1)

  • Output: claim_product_order.claim_id, cpo.display_order, cpo.claim_product_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=2
82. 0.005 0.059 ↑ 20.0 5 1

Nested Loop (cost=0.15..5.17 rows=100 width=40) (actual time=0.055..0.059 rows=5 loops=1)

  • Output: claim_product_order.claim_id, cpo.display_order, cpo.claim_product_id
  • Buffers: shared hit=2
83. 0.037 0.037 ↑ 1.0 1 1

Index Scan using claim_product_order_pkey on client_demo.claim_product_order (cost=0.14..3.16 rows=1 width=88) (actual time=0.036..0.037 rows=1 loops=1)

  • Output: claim_product_order.claim_id, claim_product_order.item_ids
  • Index Cond: (claim_product_order.claim_id = 'ba48e7a1-d9c0-4c0e-a459-175a511c11ce'::uuid)
  • Buffers: shared hit=2
84. 0.017 0.017 ↑ 20.0 5 1

Function Scan on pg_catalog.unnest cpo (cost=0.00..1.00 rows=100 width=24) (actual time=0.015..0.017 rows=5 loops=1)

  • Output: cpo.claim_product_id, cpo.display_order
  • Function Call: unnest(claim_product_order.item_ids)
85. 0.165 0.705 ↓ 22.9 206 5

Materialize (cost=18.99..28.75 rows=9 width=20) (actual time=0.052..0.141 rows=206 loops=5)

  • Output: c.contract_family_id, ct.internal_company_type
  • Buffers: shared hit=17
86. 0.098 0.540 ↓ 22.9 206 1

Hash Join (cost=18.99..28.70 rows=9 width=20) (actual time=0.255..0.540 rows=206 loops=1)

  • Output: c.contract_family_id, ct.internal_company_type
  • Inner Unique: true
  • Hash Cond: (COALESCE(cmp.company_type_id, gc.company_type_id) = ct.company_type_id)
  • Buffers: shared hit=17
87. 0.097 0.428 ↑ 1.0 206 1

Hash Left Join (cost=17.79..26.95 rows=206 width=48) (actual time=0.233..0.428 rows=206 loops=1)

  • Output: c.contract_family_id, gc.company_type_id, cmp.company_type_id
  • Inner Unique: true
  • Hash Cond: (c.contractee_company_id = cmp.company_id)
  • Buffers: shared hit=16
88. 0.079 0.144 ↑ 1.0 206 1

Hash Left Join (cost=2.58..11.20 rows=206 width=48) (actual time=0.038..0.144 rows=206 loops=1)

  • Output: c.contractee_company_id, c.contract_family_id, gc.company_type_id
  • Inner Unique: true
  • Hash Cond: (c.contractee_grouping_id = gc.grouping_id)
  • Buffers: shared hit=8
89. 0.037 0.037 ↑ 1.0 206 1

Seq Scan on client_demo.contract_family c (cost=0.00..8.06 rows=206 width=48) (actual time=0.003..0.037 rows=206 loops=1)

  • 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
  • Buffers: shared hit=6
90. 0.010 0.028 ↑ 1.0 26 1

Hash (cost=2.26..2.26 rows=26 width=32) (actual time=0.028..0.028 rows=26 loops=1)

  • Output: gc.grouping_id, gc.company_type_id
  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
  • Buffers: shared hit=2
91. 0.018 0.018 ↑ 1.0 26 1

Seq Scan on client_demo.grouping_company gc (cost=0.00..2.26 rows=26 width=32) (actual time=0.007..0.018 rows=26 loops=1)

  • Output: gc.grouping_id, gc.company_type_id
  • Buffers: shared hit=2
92. 0.087 0.187 ↑ 1.0 320 1

Hash (cost=11.20..11.20 rows=320 width=32) (actual time=0.187..0.187 rows=320 loops=1)

  • Output: cmp.company_id, cmp.company_type_id
  • Buckets: 1024 Batches: 1 Memory Usage: 28kB
  • Buffers: shared hit=8
93. 0.100 0.100 ↑ 1.0 320 1

Seq Scan on client_demo.company cmp (cost=0.00..11.20 rows=320 width=32) (actual time=0.005..0.100 rows=320 loops=1)

  • Output: cmp.company_id, cmp.company_type_id
  • Buffers: shared hit=8
94. 0.005 0.014 ↑ 1.0 9 1

Hash (cost=1.09..1.09 rows=9 width=20) (actual time=0.014..0.014 rows=9 loops=1)

  • Output: ct.internal_company_type, ct.company_type_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
95. 0.009 0.009 ↑ 1.0 9 1

Seq Scan on client_demo.company_type ct (cost=0.00..1.09 rows=9 width=20) (actual time=0.006..0.009 rows=9 loops=1)

  • Output: ct.internal_company_type, ct.company_type_id
  • Buffers: shared hit=1
96. 0.020 0.020 ↑ 1.0 1 5

Result (cost=0.00..0.04 rows=1 width=24) (actual time=0.004..0.004 rows=1 loops=5)

  • 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
97. 0.001 0.062 ↓ 0.0 0 1

Hash (cost=15.16..15.16 rows=5 width=64) (actual time=0.062..0.062 rows=0 loops=1)

  • Output: cpl.distributor_invoice_number, cpl.claim_product_id, cpl.claim_id
  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
  • Buffers: shared hit=14
98. 0.000 0.061 ↓ 0.0 0 1

Subquery Scan on cpl (cost=15.00..15.16 rows=5 width=64) (actual time=0.061..0.061 rows=0 loops=1)

  • Output: cpl.distributor_invoice_number, cpl.claim_product_id, cpl.claim_id
  • Buffers: shared hit=14
99. 0.002 0.061 ↓ 0.0 0 1

GroupAggregate (cost=15.00..15.11 rows=5 width=64) (actual time=0.060..0.061 rows=0 loops=1)

  • Output: claim_product_1.claim_id, claim_product_location.claim_product_id, string_agg(claim_product_location.distributor_invoice_number, ', '::text)
  • Group Key: claim_product_1.claim_id, claim_product_location.claim_product_id
  • Buffers: shared hit=14
100. 0.008 0.059 ↓ 0.0 0 1

Sort (cost=15.00..15.01 rows=5 width=41) (actual time=0.059..0.059 rows=0 loops=1)

  • Output: claim_product_1.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=14
101. 0.002 0.051 ↓ 0.0 0 1

Nested Loop (cost=2.10..14.94 rows=5 width=41) (actual time=0.051..0.051 rows=0 loops=1)

  • Output: claim_product_1.claim_id, claim_product_location.claim_product_id, claim_product_location.distributor_invoice_number
  • Buffers: shared hit=14
102. 0.011 0.024 ↓ 1.2 5 1

Bitmap Heap Scan on client_demo.claim_product claim_product_1 (cost=1.82..7.58 rows=4 width=32) (actual time=0.020..0.024 rows=5 loops=1)

  • Output: claim_product_1.claim_id, claim_product_1.claim_product_id
  • Recheck Cond: (claim_product_1.claim_id = 'ba48e7a1-d9c0-4c0e-a459-175a511c11ce'::uuid)
  • Heap Blocks: exact=2
  • Buffers: shared hit=4
103. 0.013 0.013 ↓ 1.2 5 1

Bitmap Index Scan on claim_product_claim_id_idx (cost=0.00..1.81 rows=4 width=0) (actual time=0.013..0.013 rows=5 loops=1)

  • Index Cond: (claim_product_1.claim_id = 'ba48e7a1-d9c0-4c0e-a459-175a511c11ce'::uuid)
  • Buffers: shared hit=2
104. 0.025 0.025 ↓ 0.0 0 5

Index Only Scan using claim_product_location_pkey on client_demo.claim_product_location (cost=0.29..1.82 rows=2 width=25) (actual time=0.005..0.005 rows=0 loops=5)

  • 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_1.claim_product_id)
  • Heap Fetches: 0
  • Buffers: shared hit=10