explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sMbi

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 53.818 2,298.604 ↓ 192.9 26,424 1

Hash Left Join (cost=69,013.61..76,708.99 rows=137 width=393) (actual time=399.058..2,298.604 rows=26,424 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_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, cpl.distributor_invoice_number)
  • 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=1324003, temp read=732 written=730
2. 12.620 2,112.215 ↓ 192.9 26,424 1

Nested Loop Left Join (cost=25,109.54..32,794.95 rows=137 width=388) (actual time=266.426..2,112.215 rows=26,424 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, ((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, ('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=1217207, temp read=732 written=730
3. 19.196 910.515 ↓ 192.9 26,424 1

Nested Loop Left Join (cost=25,107.28..27,936.45 rows=137 width=352) (actual time=266.305..910.515 rows=26,424 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, ((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
  • Buffers: shared hit=436027, temp read=732 written=730
4. 11.610 864.895 ↓ 192.9 26,424 1

Nested Loop Left Join (cost=25,107.28..27,928.23 rows=137 width=360) (actual time=266.293..864.895 rows=26,424 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, suomc.rate, tuomc.rate, ct.internal_company_type, product_uom_conversions.uom_type_ids
  • Buffers: shared hit=436027, temp read=732 written=730
5. 36.142 615.469 ↓ 192.9 26,424 1

Nested Loop Left Join (cost=25,106.44..27,761.10 rows=137 width=372) (actual time=266.246..615.469 rows=26,424 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, contract_family.contract_family_id, suomc.rate, tuomc.rate, product_uom_conversions.uom_type_ids
  • Join Filter: (contract_item.uom_type_id = suomc.uom_type_id)
  • Rows Removed by Join Filter: 1048
  • Buffers: shared hit=224635, temp read=732 written=730
6. 61.369 367.935 ↓ 192.9 26,424 1

Hash Join (cost=25,105.60..27,627.65 rows=137 width=378) (actual time=266.184..367.935 rows=26,424 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, contract_family.contract_family_id, product_uom_conversions.uom_type_ids
  • Hash Cond: (product_uom_conversions.claim_product_id = claim_product.claim_product_id)
  • Buffers: shared hit=10098, temp read=732 written=730
7. 5.981 64.621 ↓ 1.1 26,424 1

Subquery Scan on product_uom_conversions (cost=3,477.96..4,227.36 rows=24,872 width=64) (actual time=24.066..64.621 rows=26,424 loops=1)

  • Output: product_uom_conversions.uom_type_ids, product_uom_conversions.claim_product_id, product_uom_conversions.claim_id
  • Buffers: shared hit=745
8. 30.864 58.640 ↓ 1.1 26,424 1

GroupAggregate (cost=3,477.96..3,978.64 rows=24,872 width=64) (actual time=24.065..58.640 rows=26,424 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=745
9. 10.365 27.776 ↓ 1.1 27,472 1

Sort (cost=3,477.96..3,541.22 rows=25,305 width=48) (actual time=24.047..27.776 rows=27,472 loops=1)

  • Output: claim_product_2.claim_product_id, claim_product_2.claim_id, product_uom_conversion.uom_type_id
  • Sort Key: claim_product_2.claim_product_id
  • Sort Method: quicksort Memory: 2915kB
  • Buffers: shared hit=745
10. 8.546 17.411 ↓ 1.1 27,472 1

Hash Join (cost=78.09..1,627.26 rows=25,305 width=48) (actual time=0.872..17.411 rows=27,472 loops=1)

  • Output: claim_product_2.claim_product_id, claim_product_2.claim_id, product_uom_conversion.uom_type_id
  • Hash Cond: (claim_product_2.product_id = product_uom_conversion.product_id)
  • Buffers: shared hit=745
11. 8.021 8.021 ↓ 1.1 26,424 1

Index Scan using claim_product_claim_id_idx on client_pinnacle.claim_product claim_product_2 (cost=0.43..1,172.19 rows=24,872 width=48) (actual time=0.016..8.021 rows=26,424 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 = '2c3c9316-267c-4439-b4d6-e0f137e32fdf'::uuid)
  • Buffers: shared hit=724
12. 0.415 0.844 ↑ 1.0 2,518 1

Hash (cost=46.18..46.18 rows=2,518 width=32) (actual time=0.844..0.844 rows=2,518 loops=1)

  • Output: product_uom_conversion.uom_type_id, product_uom_conversion.product_id
  • Buckets: 4096 Batches: 1 Memory Usage: 190kB
  • Buffers: shared hit=21
13. 0.429 0.429 ↑ 1.0 2,518 1

Seq Scan on client_pinnacle.product_uom_conversion (cost=0.00..46.18 rows=2,518 width=32) (actual time=0.012..0.429 rows=2,518 loops=1)

  • Output: product_uom_conversion.uom_type_id, product_uom_conversion.product_id
  • Buffers: shared hit=21
14. 28.174 241.945 ↓ 1.1 26,424 1

Hash (cost=20,174.75..20,174.75 rows=24,872 width=346) (actual time=241.945..241.945 rows=26,424 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, contract_family.contract_family_id
  • Buckets: 32768 Batches: 2 Memory Usage: 5164kB
  • Buffers: shared hit=9353, temp written=585
15. 13.359 213.771 ↓ 1.1 26,424 1

Hash Left Join (cost=3,633.74..20,174.75 rows=24,872 width=346) (actual time=45.015..213.771 rows=26,424 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, contract_family.contract_family_id
  • Inner Unique: true
  • Hash Cond: (claim_product.distributor_company_id = company.company_id)
  • Buffers: shared hit=9353
16. 11.242 195.022 ↓ 1.1 26,424 1

Hash Join (cost=3,142.10..19,617.79 rows=24,872 width=315) (actual time=39.579..195.022 rows=26,424 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, 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, contract_family.contract_family_id
  • Inner Unique: true
  • Hash Cond: (claim_product.product_id = product.product_id)
  • Buffers: shared hit=9099
17. 6.580 182.568 ↓ 1.1 26,424 1

Nested Loop (cost=3,016.46..19,426.76 rows=24,872 width=277) (actual time=38.352..182.568 rows=26,424 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, 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, contract_family.contract_family_id
  • Buffers: shared hit=9030
18. 0.004 0.073 ↑ 1.0 1 1

Nested Loop Left Join (cost=1.54..10.64 rows=1 width=70) (actual time=0.069..0.073 rows=1 loops=1)

  • Output: claim.claim_id, claimant_company_type.internal_company_type, contract_family.contract_title, contract_family.contract_type, contract_family.contract_family_id
  • Inner Unique: true
  • Buffers: shared hit=16
19. 0.003 0.062 ↑ 1.0 1 1

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

  • Output: claim.claim_id, claim.contract_sequence, claimant_company_type.internal_company_type
  • Inner Unique: true
  • Buffers: shared hit=13
20. 0.003 0.054 ↑ 1.0 1 1

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

  • Output: claim.claim_id, claim.contract_sequence, claimant_company.company_type_id
  • Inner Unique: true
  • Buffers: shared hit=11
21. 0.005 0.034 ↑ 1.0 1 1

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

  • Output: claim.claim_id, claim.contract_sequence, invoice.claimant_company_id
  • Inner Unique: true
  • Buffers: shared hit=8
22. 0.017 0.017 ↑ 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.015..0.017 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 = '2c3c9316-267c-4439-b4d6-e0f137e32fdf'::uuid)
  • Buffers: shared hit=4
23. 0.012 0.012 ↑ 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.012..0.012 rows=1 loops=1)

  • Output: invoice.invoice_id, invoice.claimant_company_id
  • Index Cond: (invoice.invoice_id = claim.invoice_id)
  • Buffers: shared hit=4
24. 0.017 0.017 ↑ 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.017..0.017 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
25. 0.005 0.005 ↑ 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.005..0.005 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
26. 0.007 0.007 ↑ 1.0 1 1

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

  • 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=3
27. 56.906 175.915 ↓ 1.1 26,424 1

Merge Right Join (cost=3,014.93..19,167.40 rows=24,872 width=223) (actual time=38.278..175.915 rows=26,424 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, 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
  • Merge Cond: (contract_item.contract_item_id = claim_product.contract_item_id)
  • Buffers: shared hit=9014
28. 75.978 75.978 ↑ 1.0 376,466 1

Index Scan using contract_item_pkey on client_pinnacle.contract_item (cost=0.42..14,865.03 rows=381,407 width=81) (actual time=0.011..75.978 rows=376,466 loops=1)

  • 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
  • Buffers: shared hit=8290
29. 31.296 43.031 ↓ 1.1 26,424 1

Sort (cost=2,988.13..3,050.31 rows=24,872 width=158) (actual time=36.130..43.031 rows=26,424 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
  • Sort Key: claim_product.contract_item_id
  • Sort Method: quicksort Memory: 7684kB
  • Buffers: shared hit=724
30. 11.735 11.735 ↓ 1.1 26,424 1

Index Scan using claim_product_claim_id_idx on client_pinnacle.claim_product (cost=0.43..1,172.19 rows=24,872 width=158) (actual time=0.012..11.735 rows=26,424 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 = '2c3c9316-267c-4439-b4d6-e0f137e32fdf'::uuid)
  • Buffers: shared hit=724
31. 0.613 1.212 ↑ 1.0 2,517 1

Hash (cost=94.17..94.17 rows=2,517 width=54) (actual time=1.212..1.212 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
32. 0.599 0.599 ↑ 1.0 2,517 1

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

  • Output: product.product_name, product.product_number, product.product_id
  • Buffers: shared hit=69
33. 2.750 5.390 ↑ 1.0 10,562 1

Hash (cost=359.62..359.62 rows=10,562 width=47) (actual time=5.390..5.390 rows=10,562 loops=1)

  • Output: company.company_name, company.company_number, company.company_id
  • Buckets: 16384 Batches: 1 Memory Usage: 956kB
  • Buffers: shared hit=254
34. 2.640 2.640 ↑ 1.0 10,562 1

Seq Scan on client_pinnacle.company (cost=0.00..359.62 rows=10,562 width=47) (actual time=0.013..2.640 rows=10,562 loops=1)

  • Output: company.company_name, company.company_number, company.company_id
  • Buffers: shared hit=254
35. 24.328 211.392 ↑ 1.0 1 26,424

Nested Loop (cost=0.84..0.96 rows=1 width=58) (actual time=0.007..0.008 rows=1 loops=26,424)

  • 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=214537
36. 26.424 132.120 ↑ 1.0 1 26,424

Nested Loop (cost=0.56..0.63 rows=1 width=53) (actual time=0.005..0.005 rows=1 loops=26,424)

  • Output: pro.product_id, suomc.rate, suomc.product_id, suomc.uom_type_id
  • Buffers: shared hit=132121
37. 52.848 52.848 ↑ 1.0 1 26,424

Index Only Scan using product_pkey on client_pinnacle.product pro (cost=0.28..0.30 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=26,424)

  • Output: pro.product_id
  • Index Cond: (pro.product_id = claim_product.product_id)
  • Heap Fetches: 0
  • Buffers: shared hit=52849
38. 52.848 52.848 ↑ 1.0 1 26,424

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=26,424)

  • Output: suomc.product_id, suomc.uom_type_id, suomc.rate
  • Index Cond: (suomc.product_id = pro.product_id)
  • Buffers: shared hit=79272
39. 54.944 54.944 ↑ 1.0 1 27,472

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.001..0.002 rows=1 loops=27,472)

  • Output: tuomc.product_id, tuomc.uom_type_id, tuomc.rate
  • Index Cond: (tuomc.product_id = pro.product_id)
  • Buffers: shared hit=82416
40. 52.848 237.816 ↑ 1.0 1 26,424

Nested Loop (cost=0.84..1.21 rows=1 width=20) (actual time=0.008..0.009 rows=1 loops=26,424)

  • Output: c.contract_family_id, ct.internal_company_type
  • Inner Unique: true
  • Buffers: shared hit=211392
41. 26.424 158.544 ↑ 1.0 1 26,424

Nested Loop Left Join (cost=0.71..0.92 rows=1 width=48) (actual time=0.006..0.006 rows=1 loops=26,424)

  • Output: c.contract_family_id, gc.company_type_id, cmp.company_type_id
  • Inner Unique: true
  • Buffers: shared hit=158544
42. 26.424 79.272 ↑ 1.0 1 26,424

Nested Loop Left Join (cost=0.42..0.54 rows=1 width=48) (actual time=0.003..0.003 rows=1 loops=26,424)

  • Output: c.contractee_company_id, c.contract_family_id, gc.company_type_id
  • Inner Unique: true
  • Buffers: shared hit=79272
43. 52.848 52.848 ↑ 1.0 1 26,424

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=26,424)

  • 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=79272
44. 0.000 0.000 ↓ 0.0 0 26,424

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=26,424)

  • 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)
45. 52.848 52.848 ↑ 1.0 1 26,424

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=26,424)

  • 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=79272
46. 26.424 26.424 ↑ 1.0 1 26,424

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=26,424)

  • 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=52848
47. 26.424 26.424 ↑ 1.0 1 26,424

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

  • 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
48. 59.543 1,189.080 ↑ 1.0 1 26,424

Nested Loop Left Join (cost=2.26..35.45 rows=1 width=68) (actual time=0.035..0.045 rows=1 loops=26,424)

  • 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=781180
49. 26.939 792.720 ↑ 1.0 1 26,424

Nested Loop (cost=1.98..35.13 rows=1 width=70) (actual time=0.021..0.030 rows=1 loops=26,424)

  • 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))
  • Rows Removed by Join Filter: 0
  • Buffers: shared hit=703453
50. 53.363 739.872 ↑ 1.0 1 26,424

Nested Loop (cost=1.70..34.82 rows=1 width=129) (actual time=0.018..0.028 rows=1 loops=26,424)

  • 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=625726
51. 27.454 660.600 ↑ 1.0 1 26,424

Nested Loop (cost=1.42..34.51 rows=1 width=113) (actual time=0.016..0.025 rows=1 loops=26,424)

  • 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=573907
52. 58.513 581.328 ↑ 95.0 1 26,424

Nested Loop (cost=1.14..6.00 rows=95 width=108) (actual time=0.013..0.022 rows=1 loops=26,424)

  • 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=496180
53. 26.424 237.816 ↑ 1.0 1 26,424

Nested Loop (cost=0.86..4.42 rows=1 width=64) (actual time=0.009..0.009 rows=1 loops=26,424)

  • 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=211181
54. 105.696 105.696 ↑ 1.0 1 26,424

Index Scan using claim_product_pkey on client_pinnacle.claim_product claim_product_1 (cost=0.43..2.67 rows=1 width=48) (actual time=0.004..0.004 rows=1 loops=26,424)

  • 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 = '2c3c9316-267c-4439-b4d6-e0f137e32fdf'::uuid) AND (claim_product.claim_id = claim_product_1.claim_id))
  • Buffers: shared hit=105896
55. 105.696 105.696 ↑ 1.0 1 26,424

Index Scan using claim_product_price_pkey on client_pinnacle.claim_product_price (cost=0.43..1.74 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=26,424)

  • 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=105285
56. 0.000 284.999 ↑ 5.0 1 25,909

Append (cost=0.28..1.53 rows=5 width=60) (actual time=0.003..0.011 rows=1 loops=25,909)

  • Buffers: shared hit=284999
57. 77.727 77.727 ↑ 1.0 1 25,909

Index Scan using price_default_pkey on client_pinnacle.price_default (cost=0.28..0.30 rows=1 width=58) (actual time=0.002..0.003 rows=1 loops=25,909)

  • 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)
  • Buffers: shared hit=77727
58. 77.727 77.727 ↓ 0.0 0 25,909

Index Scan using price_generated_pkey on client_pinnacle.price_sale (cost=0.43..0.47 rows=1 width=60) (actual time=0.003..0.003 rows=0 loops=25,909)

  • 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)
  • Buffers: shared hit=77727
59. 51.818 51.818 ↓ 0.0 0 25,909

Index Scan using price_company_pkey on client_pinnacle.price_company (cost=0.29..0.30 rows=1 width=58) (actual time=0.002..0.002 rows=0 loops=25,909)

  • 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)
  • Buffers: shared hit=51818
60. 25.909 25.909 ↓ 0.0 0 25,909

Index Scan using price_list_pkey on client_pinnacle.price_list (cost=0.15..0.17 rows=1 width=84) (actual time=0.001..0.001 rows=0 loops=25,909)

  • 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)
  • Buffers: shared hit=25909
61. 51.818 51.818 ↓ 0.0 0 25,909

Index Scan using price_class_pkey on client_pinnacle.price_class (cost=0.28..0.30 rows=1 width=58) (actual time=0.002..0.002 rows=0 loops=25,909)

  • 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)
  • Buffers: shared hit=51818
62. 51.818 51.818 ↑ 1.0 1 25,909

Index Scan using product_uom_conversion_pkey on client_pinnacle.product_uom_conversion suomc_1 (cost=0.28..0.30 rows=1 width=37) (actual time=0.002..0.002 rows=1 loops=25,909)

  • 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))
  • Buffers: shared hit=77727
63. 25.909 25.909 ↑ 1.0 1 25,909

Index Only Scan using product_pkey on client_pinnacle.product pro_1 (cost=0.28..0.30 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=25,909)

  • Output: pro_1.product_id
  • Index Cond: (pro_1.product_id = price_default.product_id)
  • Heap Fetches: 0
  • Buffers: shared hit=51819
64. 25.909 25.909 ↑ 1.0 1 25,909

Index Scan using product_uom_conversion_pkey on client_pinnacle.product_uom_conversion tuomc_1 (cost=0.28..0.30 rows=1 width=37) (actual time=0.001..0.001 rows=1 loops=25,909)

  • Output: tuomc_1.product_id, tuomc_1.uom_type_id, tuomc_1.rate
  • Index Cond: (tuomc_1.product_id = price_default.product_id)
  • Buffers: shared hit=77727
65. 336.817 336.817 ↓ 0.0 0 25,909

Index Scan using price_modified_excl on client_pinnacle.price_modified pm (cost=0.28..0.30 rows=1 width=27) (actual time=0.013..0.013 rows=0 loops=25,909)

  • 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)
  • Buffers: shared hit=77727
66. 7.124 132.571 ↓ 1.6 26,424 1

Hash (cost=43,659.40..43,659.40 rows=16,311 width=64) (actual time=132.571..132.571 rows=26,424 loops=1)

  • Output: cpl.distributor_invoice_number, cpl.claim_product_id, cpl.claim_id
  • Buckets: 32768 (originally 16384) Batches: 1 (originally 1) Memory Usage: 1934kB
  • Buffers: shared hit=106796
67. 4.123 125.447 ↓ 1.6 26,424 1

Subquery Scan on cpl (cost=43,129.30..43,659.40 rows=16,311 width=64) (actual time=106.483..125.447 rows=26,424 loops=1)

  • Output: cpl.distributor_invoice_number, cpl.claim_product_id, cpl.claim_id
  • Buffers: shared hit=106796
68. 12.898 121.324 ↓ 1.6 26,424 1

GroupAggregate (cost=43,129.30..43,496.29 rows=16,311 width=64) (actual time=106.483..121.324 rows=26,424 loops=1)

  • 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=106796
69. 11.152 108.426 ↓ 1.6 26,424 1

Sort (cost=43,129.30..43,170.07 rows=16,311 width=33) (actual time=106.457..108.426 rows=26,424 loops=1)

  • 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: 2833kB
  • Buffers: shared hit=106796
70. 9.267 97.274 ↓ 1.6 26,424 1

Nested Loop (cost=0.99..41,988.05 rows=16,311 width=33) (actual time=0.030..97.274 rows=26,424 loops=1)

  • Output: claim_product_3.claim_id, claim_product_location.claim_product_id, claim_product_location.distributor_invoice_number
  • Buffers: shared hit=106796
71. 8.735 8.735 ↓ 1.1 26,424 1

Index Scan using claim_product_claim_id_idx on client_pinnacle.claim_product claim_product_3 (cost=0.43..1,172.19 rows=24,872 width=32) (actual time=0.012..8.735 rows=26,424 loops=1)

  • Output: claim_product_3.claim_id, claim_product_3.claim_product_id
  • Index Cond: (claim_product_3.claim_id = '2c3c9316-267c-4439-b4d6-e0f137e32fdf'::uuid)
  • Buffers: shared hit=724
72. 79.272 79.272 ↑ 5.0 1 26,424

Index Only Scan using claim_product_location_pkey on client_pinnacle.claim_product_location (cost=0.56..1.59 rows=5 width=17) (actual time=0.003..0.003 rows=1 loops=26,424)

  • 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=106072