Slow Running Queries in Azure PostgreSQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

Hi Team,

 

Greetings,

 

We are facing an issue with long running queries in PostgreSQL Database. We recently migrated the database from Oracle to PostgreSQL and we found that there are approx. 4 to 5 queries which was running in oracle in 5 mins and it is taking more than 50 mins in PostgreSQL. We checked every parameter in PostgreSQL, but it is not helping.

 

I am attaching the query and explain plan with Analyze option in the attachment, but it is not helping.

 

Request you to please help and assist on this as it is hampering the productivity and effecting the business.

 

Thanks and Regards,

Mukesh Kumar

 

"Unique  (cost=529701.37..529701.43 rows=1 width=574) (actual time=2695930.462..2695933.678 rows=3729 loops=1)"
"  ->  Sort  (cost=529701.37..529701.37 rows=1 width=574) (actual time=2695930.462..2695931.403 rows=3729 loops=1)"
"        Sort Key: so_phci_entity_base.phci_entity_type_f, lms_reserve_sec_region_lkup.reserve_sec_region_name, lms_property_rights_base.ownership_category_f, lms_reserve_minor_class_lkup.reserve_minor_class_k, so_country_state_assoc_lkup.description, (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) * (('100'::numeric - (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'W_Moisture'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) / '100'::numeric))), ((CASE WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END = '0'::numeric) THEN 'Insufficient'::text WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END < 1.2) THEN '< 1.2 lbs'::text WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END < 2.5) THEN '> 1.2 to 2.5 lbs.'::text WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END >= 2.5) THEN '> 2.5 lbs'::text ELSE 'Insufficient'::text END)::character varying), lms_reserve_mining_type_lkup_1.mining_type_display, lms_reserve_mining_type_lkup.mining_type_display, lms_reserve_category_lkup.reserve_category_k, ""*SELECT* 1"".statecode, (CASE WHEN (lms_reserve_mining_type_lkup_1.mining_type_display IS NULL) THEN lms_reserve_mining_type_lkup.mining_type_display ELSE lms_reserve_mining_type_lkup_1.mining_type_display END), lms_reserve_stateofmining_lkup.reserve_state_of_mining_code_k, ""*SELECT* 1"".upsid, lms_categorized_reserve_base.coal_acres, lms_categorized_reserve_base.yardage, lms_categorized_reserve_base.avg_thickness, (sum(lms_property_rights_base.numerator)), (sum(lms_property_rights_base.denominator)), (sum(lms_categorized_reserve_base.wash_percentage)), (sum(lms_categorized_reserve_base.recovery_percentage)), lms_categorized_reserve_base.tons_per_acre_foot, ((((""*SELECT* 1"".statecode)::text || lpad((""*SELECT* 1"".countyfip)::text, 3, '0'::text)) || lpad((""*SELECT* 1"".upno)::text, 5, '0'::text))), (sum((((((lms_categorized_reserve_base.tons_per_acre_foot * lms_categorized_reserve_base.avg_thickness) * lms_categorized_reserve_base.coal_acres) * (lms_property_rights_base.numerator / lms_property_rights_base.denominator)) * (lms_categorized_reserve_base.recovery_percentage / '100'::numeric)) * (lms_categorized_reserve_base.wash_percentage / '100'::numeric))))"
"        Sort Method: quicksort  Memory: 1087kB"
"        ->  GroupAggregate  (cost=529701.18..529701.36 rows=1 width=574) (actual time=2695914.626..2695926.298 rows=3729 loops=1)"
"              Group Key: so_phci_entity_base.phci_entity_type_f, lms_reserve_sec_region_lkup.reserve_sec_region_name, lms_property_rights_base.ownership_category_f, lms_reserve_minor_class_lkup.reserve_minor_class_k, so_country_state_assoc_lkup.description, (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) * (('100'::numeric - (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'W_Moisture'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) / '100'::numeric))), ((CASE WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END = '0'::numeric) THEN 'Insufficient'::text WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END < 1.2) THEN '< 1.2 lbs'::text WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END < 2.5) THEN '> 1.2 to 2.5 lbs.'::text WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END >= 2.5) THEN '> 2.5 lbs'::text ELSE 'Insufficient'::text END)::character varying), lms_reserve_mining_type_lkup_1.mining_type_display, lms_reserve_mining_type_lkup.mining_type_display, lms_reserve_category_lkup.reserve_category_k, ""*SELECT* 1"".statecode, lms_reserve_mining_type_lkup.mining_type_display, (CASE WHEN (lms_reserve_mining_type_lkup_1.mining_type_display IS NULL) THEN lms_reserve_mining_type_lkup.mining_type_display ELSE lms_reserve_mining_type_lkup_1.mining_type_display END), lms_reserve_stateofmining_lkup.reserve_state_of_mining_code_k, ""*SELECT* 1"".upsid, lms_categorized_reserve_base.coal_acres, lms_categorized_reserve_base.yardage, lms_categorized_reserve_base.avg_thickness, lms_categorized_reserve_base.tons_per_acre_foot, ((((""*SELECT* 1"".statecode)::text || lpad((""*SELECT* 1"".countyfip)::text, 3, '0'::text)) || lpad((""*SELECT* 1"".upno)::text, 5, '0'::text)))"
"              ->  Sort  (cost=529701.18..529701.19 rows=1 width=466) (actual time=2695914.606..2695915.531 rows=3853 loops=1)"
"                    Sort Key: so_phci_entity_base.phci_entity_type_f, lms_reserve_sec_region_lkup.reserve_sec_region_name, lms_property_rights_base.ownership_category_f, lms_reserve_minor_class_lkup.reserve_minor_class_k, so_country_state_assoc_lkup.description, (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) * (('100'::numeric - (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'W_Moisture'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) / '100'::numeric))), ((CASE WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END = '0'::numeric) THEN 'Insufficient'::text WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END < 1.2) THEN '< 1.2 lbs'::text WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END < 2.5) THEN '> 1.2 to 2.5 lbs.'::text WHEN (CASE WHEN ((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) = '0'::numeric) THEN '0'::numeric ELSE (((sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)) / (sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END))) * 19981.2) END >= 2.5) THEN '> 2.5 lbs'::text ELSE 'Insufficient'::text END)::character varying), lms_reserve_mining_type_lkup_1.mining_type_display, lms_reserve_mining_type_lkup.mining_type_display, lms_reserve_category_lkup.reserve_category_k, ""*SELECT* 1"".statecode, (CASE WHEN (lms_reserve_mining_type_lkup_1.mining_type_display IS NULL) THEN lms_reserve_mining_type_lkup.mining_type_display ELSE lms_reserve_mining_type_lkup_1.mining_type_display END), lms_reserve_stateofmining_lkup.reserve_state_of_mining_code_k, ""*SELECT* 1"".upsid, lms_categorized_reserve_base.coal_acres, lms_categorized_reserve_base.yardage, lms_categorized_reserve_base.avg_thickness, lms_categorized_reserve_base.tons_per_acre_foot, ((((""*SELECT* 1"".statecode)::text || lpad((""*SELECT* 1"".countyfip)::text, 3, '0'::text)) || lpad((""*SELECT* 1"".upno)::text, 5, '0'::text)))"
"                    Sort Method: quicksort  Memory: 1120kB"
"                    ->  Nested Loop  (cost=485996.66..529701.17 rows=1 width=466) (actual time=31511.519..2695868.984 rows=3853 loops=1)"
"                          Join Filter: ((lms_reserve_area_extension.reserve_entity_sid_c)::text = (so_phci_entity_base.phci_entity_sid_k)::text)"
"                          Rows Removed by Join Filter: 545261"
"                          ->  Nested Loop Left Join  (cost=485994.37..529674.17 rows=1 width=492) (actual time=31510.763..2695091.652 rows=3867 loops=1)"
"                                ->  Nested Loop Left Join  (cost=485994.23..529674.00 rows=1 width=499) (actual time=31510.699..2695050.571 rows=3867 loops=1)"
"                                      ->  Nested Loop Left Join  (cost=485993.95..529673.71 rows=1 width=480) (actual time=31510.638..2694918.429 rows=3867 loops=1)"
"                                            Join Filter: ((lms_primary_subarea_base_cycle.primarysubarea_sid_k)::text = (lms_upseamreservearea_assoc.primarysubarea_sid_f)::text)"
"                                            Rows Removed by Join Filter: 2919666"
"                                            ->  Nested Loop Left Join  (cost=485927.92..529583.08 rows=1 width=438) (actual time=31506.153..2693555.775 rows=3867 loops=1)"
"                                                  Join Filter: ((lms_categorized_reserve_base.categorized_reserve_sid_k)::text = (lms_catreserve_parmvalues_base.categorized_reserve_sid_c)::text)"
"                                                  Rows Removed by Join Filter: 642098758"
"                                                  ->  Nested Loop  (cost=11988.92..49173.52 rows=1 width=360) (actual time=16879.183..2287032.073 rows=3867 loops=1)"
"                                                        ->  Nested Loop  (cost=11988.78..49173.11 rows=1 width=360) (actual time=16879.167..2286967.728 rows=3897 loops=1)"
"                                                              ->  Nested Loop  (cost=11988.65..49172.52 rows=1 width=360) (actual time=2693.833..2286525.992 rows=48363 loops=1)"
"                                                                    ->  Nested Loop  (cost=11988.51..49170.96 rows=1 width=350) (actual time=2693.808..2285352.656 rows=48363 loops=1)"
"                                                                          Join Filter: ((lms_up_seam_reserve_assoc.up_sid_c)::text = (""*SELECT* 1"".upsid)::text)"
"                                                                          Rows Removed by Join Filter: 2871810009"
"                                                                          ->  Nested Loop  (cost=6486.52..43331.21 rows=1 width=283) (actual time=2192.032..22015.939 rows=49326 loops=1)"
"                                                                                ->  Nested Loop  (cost=6486.10..43330.59 rows=1 width=270) (actual time=2191.970..20389.934 rows=51096 loops=1)"
"                                                                                      Join Filter: ((entity_base.entity_sid_k)::text = (so_phci_entity_base.phci_entity_sid_k)::text)"
"                                                                                      Rows Removed by Join Filter: 184098888"
"                                                                                      ->  Index Scan using so_phci_entity_base_pkey on so_phci_entity_base  (cost=0.28..157.65 rows=3604 width=30) (actual time=0.007..11.241 rows=3604 loops=1)"
"                                                                                      ->  Materialize  (cost=6485.82..43118.88 rows=1 width=240) (actual time=0.043..2.081 rows=51096 loops=3604)"
"                                                                                            ->  Nested Loop  (cost=6485.82..43118.88 rows=1 width=240) (actual time=155.904..1885.756 rows=51096 loops=1)"
"                                                                                                  ->  Nested Loop  (cost=6485.53..43118.57 rows=1 width=224) (actual time=155.883..1610.873 rows=51096 loops=1)"
"                                                                                                        ->  Nested Loop  (cost=6485.11..43118.11 rows=1 width=172) (actual time=155.611..1211.386 rows=51217 loops=1)"
"                                                                                                              ->  Hash Join  (cost=6484.69..43117.63 rows=1 width=198) (actual time=155.508..820.705 rows=52841 loops=1)"
"                                                                                                                    Hash Cond: (((lms_doc_property_rights_assoc.doc_sid_c)::text = (lms_doc_propright_status_assoc.doc_sid_c)::text) AND ((lms_property_rights_base.property_sid_k)::text = (lms_doc_propright_status_assoc.property_sid_c)::text))"
"                                                                                                                    ->  Append  (cost=5832.77..40901.92 rows=89359 width=614) (actual time=152.309..774.394 rows=182799 loops=1)"
"                                                                                                                          ->  Hash Join  (cost=5832.77..11802.58 rows=82431 width=125) (actual time=152.308..255.509 rows=145080 loops=1)"
"                                                                                                                                Hash Cond: ((lms_up_seam_reserve_assoc_1.up_sid_c)::text = (lms_prop_up_assoc.up_sid_c)::text)"
"                                                                                                                                ->  Seq Scan on lms_up_seam_reserve_assoc lms_up_seam_reserve_assoc_1  (cost=0.00..3486.59 rows=147459 width=29) (actual time=0.011..16.611 rows=147459 loops=1)"
"                                                                                                                                ->  Hash  (cost=5574.98..5574.98 rows=20623 width=111) (actual time=152.134..152.138 rows=51704 loops=1)"
"                                                                                                                                      Buckets: 65536 (originally 32768)  Batches: 1 (originally 1)  Memory Usage: 7333kB"
"                                                                                                                                      ->  Nested Loop  (cost=1463.28..5574.98 rows=20623 width=111) (actual time=20.344..124.179 rows=51704 loops=1)"
"                                                                                                                                            Join Filter: ((lms_property_rights_base.property_sid_k)::text = (lms_prop_up_assoc.property_sid_c)::text)"
"                                                                                                                                            ->  Hash Join  (cost=1462.86..2365.25 rows=2542 width=135) (actual time=20.318..31.170 rows=8845 loops=1)"
"                                                                                                                                                  Hash Cond: ((lms_doc_property_rights_assoc.property_sid_c)::text = (lms_property_rights_base.property_sid_k)::text)"
"                                                                                                                                                  ->  Seq Scan on lms_doc_property_rights_assoc  (cost=0.00..750.98 rows=33598 width=36) (actual time=0.005..3.159 rows=33598 loops=1)"
"                                                                                                                                                  ->  Hash  (cost=1431.09..1431.09 rows=2542 width=99) (actual time=20.288..20.290 rows=8845 loops=1)"
"                                                                                                                                                        Buckets: 16384 (originally 4096)  Batches: 1 (originally 1)  Memory Usage: 1185kB"
"                                                                                                                                                        ->  Hash Join  (cost=1039.63..1431.09 rows=2542 width=99) (actual time=10.213..15.959 rows=8845 loops=1)"
"                                                                                                                                                              Hash Cond: ((lms_coal_property_rights_base.property_sid_c)::text = (lms_property_rights_base.property_sid_k)::text)"
"                                                                                                                                                              ->  Seq Scan on lms_coal_property_rights_base  (cost=0.00..365.10 rows=10040 width=43) (actual time=0.007..1.867 rows=10040 loops=1)"
"                                                                                                                                                                    Filter: ((how_to_use_seam_assoc_f)::text = 'ALL'::text)"
"                                                                                                                                                                    Rows Removed by Filter: 5488"
"                                                                                                                                                              ->  Hash  (cost=933.32..933.32 rows=8505 width=56) (actual time=10.115..10.115 rows=13269 loops=1)"
"                                                                                                                                                                    Buckets: 16384  Batches: 1  Memory Usage: 1280kB"
"                                                                                                                                                                    ->  Index Scan using prop_rights_coalyn_idx on lms_property_rights_base  (cost=0.29..933.32 rows=8505 width=56) (actual time=0.022..6.392 rows=13269 loops=1)"
"                                                                                                                                                                          Index Cond: ((coal_rights_yn)::text = 'Y'::text)"
"                                                                                                                                                                          Filter: ((ownership_category_f)::text = ANY ('{LEASED,OPTION,OWNED}'::text[]))"
"                                                                                                                                                                          Rows Removed by Filter: 2303"
"                                                                                                                                            ->  Index Only Scan using lms_prop_up_assoc_pkey on lms_prop_up_assoc  (cost=0.42..0.98 rows=23 width=33) (actual time=0.007..0.009 rows=6 loops=8845)"
"                                                                                                                                                  Index Cond: (property_sid_c = (lms_doc_property_rights_assoc.property_sid_c)::text)"
"                                                                                                                                                  Heap Fetches: 51704"
"                                                                                                                          ->  Nested Loop  (cost=245.65..3519.18 rows=450 width=125) (actual time=1.809..236.381 rows=16481 loops=1)"
"                                                                                                                                Join Filter: ((lms_prop_rights_seam_assoc.seam_sid_c)::text = (lms_up_seam_reserve_assoc_2.seam_sid_c)::text)"
"                                                                                                                                Rows Removed by Join Filter: 34719"
"                                                                                                                                ->  Nested Loop  (cost=245.23..1872.02 rows=2984 width=125) (actual time=1.658..87.853 rows=21346 loops=1)"
"                                                                                                                                      Join Filter: ((lms_property_rights_base_1.property_sid_k)::text = (lms_prop_up_assoc_1.property_sid_c)::text)"
"                                                                                                                                      ->  Nested Loop  (cost=244.81..1407.35 rows=368 width=168) (actual time=1.639..54.652 rows=3419 loops=1)"
"                                                                                                                                            ->  Nested Loop  (cost=244.39..1216.67 rows=368 width=132) (actual time=1.623..32.697 rows=3419 loops=1)"
"                                                                                                                                                  Join Filter: ((lms_coal_property_rights_base_1.property_sid_c)::text = (lms_property_rights_base_1.property_sid_k)::text)"
"                                                                                                                                                  ->  Hash Join  (cost=243.98..407.36 rows=1453 width=76) (actual time=1.596..4.584 rows=4262 loops=1)"
"                                                                                                                                                        Hash Cond: ((lms_prop_rights_seam_assoc.property_sid_c)::text = (lms_coal_property_rights_base_1.property_sid_c)::text)"
"                                                                                                                                                        ->  Seq Scan on lms_prop_rights_seam_assoc  (cost=0.00..142.92 rows=7792 width=33) (actual time=0.012..0.664 rows=7792 loops=1)"
"                                                                                                                                                        ->  Hash  (cost=207.78..207.78 rows=2896 width=43) (actual time=1.563..1.564 rows=2896 loops=1)"
"                                                                                                                                                              Buckets: 4096  Batches: 1  Memory Usage: 241kB"
"                                                                                                                                                              ->  Index Scan using coal_prop_rights_howtouse_idx on lms_coal_property_rights_base lms_coal_property_rights_base_1  (cost=0.29..207.78 rows=2896 width=43) (actual time=0.021..0.945 rows=2896 loops=1)"
"                                                                                                                                                                    Index Cond: ((how_to_use_seam_assoc_f)::text = 'ONLYINCLUDING'::text)"
"                                                                                                                                                  ->  Index Scan using lms_property_rights_base_pkey on lms_property_rights_base lms_property_rights_base_1  (cost=0.41..0.54 rows=1 width=56) (actual time=0.006..0.006 rows=1 loops=4262)"
"                                                                                                                                                        Index Cond: ((property_sid_k)::text = (lms_prop_rights_seam_assoc.property_sid_c)::text)"
"                                                                                                                                                        Filter: (((coal_rights_yn)::text = 'Y'::text) AND ((ownership_category_f)::text = ANY ('{LEASED,OPTION,OWNED}'::text[])))"
"                                                                                                                                                        Rows Removed by Filter: 0"
"                                                                                                                                            ->  Index Scan using proprights_prop_idx on lms_doc_property_rights_assoc lms_doc_property_rights_assoc_1  (cost=0.41..0.51 rows=1 width=36) (actual time=0.006..0.006 rows=1 loops=3419)"
"                                                                                                                                                  Index Cond: ((property_sid_c)::text = (lms_property_rights_base_1.property_sid_k)::text)"
"                                                                                                                                      ->  Index Only Scan using lms_prop_up_assoc_pkey on lms_prop_up_assoc lms_prop_up_assoc_1  (cost=0.42..0.98 rows=23 width=33) (actual time=0.007..0.008 rows=6 loops=3419)"
"                                                                                                                                            Index Cond: (property_sid_c = (lms_doc_property_rights_assoc_1.property_sid_c)::text)"
"                                                                                                                                            Heap Fetches: 21346"
"                                                                                                                                ->  Index Only Scan using lms_up_seam_reserve_assoc_up_sid_c_seam_sid_c_key on lms_up_seam_reserve_assoc lms_up_seam_reserve_assoc_2  (cost=0.42..0.50 rows=4 width=29) (actual time=0.006..0.006 rows=2 loops=21346)"
"                                                                                                                                      Index Cond: (up_sid_c = (lms_prop_up_assoc_1.up_sid_c)::text)"
"                                                                                                                                      Heap Fetches: 51200"
"                                                                                                                          ->  Nested Loop  (cost=197.34..21462.37 rows=6421 width=125) (actual time=1.946..182.540 rows=12164 loops=1)"
"                                                                                                                                ->  Nested Loop  (cost=196.92..1856.65 rows=3213 width=130) (actual time=1.816..34.539 rows=6386 loops=1)"
"                                                                                                                                      Join Filter: ((lms_property_rights_base_2.property_sid_k)::text = (lms_prop_up_assoc_2.property_sid_c)::text)"
"                                                                                                                                      ->  Nested Loop  (cost=196.50..1356.63 rows=396 width=135) (actual time=1.735..20.439 rows=1405 loops=1)"
"                                                                                                                                            ->  Hash Join  (cost=196.08..1151.44 rows=396 width=99) (actual time=1.713..9.967 rows=1405 loops=1)"
"                                                                                                                                                  Hash Cond: ((lms_property_rights_base_2.property_sid_k)::text = (lms_coal_property_rights_base_2.property_sid_c)::text)"
"                                                                                                                                                  ->  Index Scan using prop_rights_coalyn_idx on lms_property_rights_base lms_property_rights_base_2  (cost=0.29..933.32 rows=8505 width=56) (actual time=0.026..6.870 rows=13269 loops=1)"
"                                                                                                                                                        Index Cond: ((coal_rights_yn)::text = 'Y'::text)"
"                                                                                                                                                        Filter: ((ownership_category_f)::text = ANY ('{LEASED,OPTION,OWNED}'::text[]))"
"                                                                                                                                                        Rows Removed by Filter: 2303"
"                                                                                                                                                  ->  Hash  (cost=176.26..176.26 rows=1563 width=43) (actual time=1.118..1.119 rows=1563 loops=1)"
"                                                                                                                                                        Buckets: 2048  Batches: 1  Memory Usage: 123kB"
"                                                                                                                                                        ->  Index Scan using coal_prop_rights_howtouse_idx on lms_coal_property_rights_base lms_coal_property_rights_base_2  (cost=0.29..176.26 rows=1563 width=43) (actual time=0.013..0.673 rows=1563 loops=1)"
"                                                                                                                                                              Index Cond: ((how_to_use_seam_assoc_f)::text = 'ALLEXCEPT'::text)"
"                                                                                                                                            ->  Index Scan using proprights_prop_idx on lms_doc_property_rights_assoc lms_doc_property_rights_assoc_2  (cost=0.41..0.51 rows=1 width=36) (actual time=0.007..0.007 rows=1 loops=1405)"
"                                                                                                                                                  Index Cond: ((property_sid_c)::text = (lms_property_rights_base_2.property_sid_k)::text)"
"                                                                                                                                      ->  Index Only Scan using lms_prop_up_assoc_pkey on lms_prop_up_assoc lms_prop_up_assoc_2  (cost=0.42..0.98 rows=23 width=33) (actual time=0.007..0.009 rows=5 loops=1405)"
"                                                                                                                                            Index Cond: (property_sid_c = (lms_doc_property_rights_assoc_2.property_sid_c)::text)"
"                                                                                                                                            Heap Fetches: 6386"
"                                                                                                                                ->  Index Only Scan using lms_up_seam_reserve_assoc_up_sid_c_seam_sid_c_key on lms_up_seam_reserve_assoc lms_up_seam_reserve_assoc_3  (cost=0.42..6.08 rows=2 width=29) (actual time=0.012..0.023 rows=2 loops=6386)"
"                                                                                                                                      Index Cond: (up_sid_c = (lms_prop_up_assoc_2.up_sid_c)::text)"
"                                                                                                                                      Filter: (NOT (SubPlan 1))"
"                                                                                                                                      Rows Removed by Filter: 1"
"                                                                                                                                      Heap Fetches: 19137"
"                                                                                                                                      SubPlan 1"
"                                                                                                                                        ->  Index Only Scan using lms_prop_rights_seam_assoc_pkey on lms_prop_rights_seam_assoc lms_prop_rights_seam_assoc_5  (cost=0.28..2.50 rows=1 width=14) (actual time=0.004..0.005 rows=1 loops=19137)"
"                                                                                                                                              Index Cond: (property_sid_c = (lms_prop_up_assoc_2.property_sid_c)::text)"
"                                                                                                                                              Heap Fetches: 28011"
"                                                                                                                          ->  Hash Join  (cost=256.52..745.92 rows=16 width=125) (actual time=1.901..24.634 rows=2413 loops=1)"
"                                                                                                                                Hash Cond: (((lms_property_rights_base_3.state_code_f)::text = (so_seam_base_1.state_f)::text) AND ((lms_up_seam_reserve_assoc_4.seam_sid_c)::text = (so_seam_base_1.seam_sid_k)::text))"
"                                                                                                                                Join Filter: (so_seam_base_1.seam_order < so_seam_base.seam_order)"
"                                                                                                                                Rows Removed by Join Filter: 2890"
"                                                                                                                                ->  Nested Loop  (cost=139.87..622.95 rows=1203 width=133) (actual time=0.444..21.089 rows=5303 loops=1)"
"                                                                                                                                      ->  Nested Loop  (cost=139.45..459.81 rows=301 width=119) (actual time=0.427..9.631 rows=1164 loops=1)"
"                                                                                                                                            Join Filter: ((lms_property_rights_base_3.property_sid_k)::text = (lms_prop_up_assoc_3.property_sid_c)::text)"
"                                                                                                                                            ->  Nested Loop  (cost=139.03..413.09 rows=37 width=162) (actual time=0.383..7.099 rows=205 loops=1)"
"                                                                                                                                                  ->  Nested Loop  (cost=138.75..401.79 rows=37 width=168) (actual time=0.369..6.030 rows=205 loops=1)"
"                                                                                                                                                        ->  Nested Loop  (cost=138.33..382.62 rows=37 width=132) (actual time=0.356..4.340 rows=205 loops=1)"
"                                                                                                                                                              Join Filter: ((lms_coal_property_rights_base_3.property_sid_c)::text = (lms_property_rights_base_3.property_sid_k)::text)"
"                                                                                                                                                              ->  Hash Join  (cost=137.92..301.30 rows=146 width=76) (actual time=0.313..1.932 rows=291 loops=1)"
"                                                                                                                                                                    Hash Cond: ((lms_prop_rights_seam_assoc_1.property_sid_c)::text = (lms_coal_property_rights_base_3.property_sid_c)::text)"
"                                                                                                                                                                    ->  Seq Scan on lms_prop_rights_seam_assoc lms_prop_rights_seam_assoc_1  (cost=0.00..142.92 rows=7792 width=33) (actual time=0.010..0.705 rows=7792 loops=1)"
"                                                                                                                                                                    ->  Hash  (cost=134.28..134.28 rows=291 width=43) (actual time=0.271..0.271 rows=291 loops=1)"
"                                                                                                                                                                          Buckets: 1024  Batches: 1  Memory Usage: 28kB"
"                                                                                                                                                                          ->  Index Scan using coal_prop_rights_howtouse_idx on lms_coal_property_rights_base lms_coal_property_rights_base_3  (cost=0.29..134.28 rows=291 width=43) (actual time=0.017..0.173 rows=291 loops=1)"
"                                                                                                                                                                                Index Cond: ((how_to_use_seam_assoc_f)::text = 'ALLABOVE'::text)"
"                                                                                                                                                              ->  Index Scan using lms_property_rights_base_pkey on lms_property_rights_base lms_property_rights_base_3  (cost=0.41..0.54 rows=1 width=56) (actual time=0.008..0.008 rows=1 loops=291)"
"                                                                                                                                                                    Index Cond: ((property_sid_k)::text = (lms_prop_rights_seam_assoc_1.property_sid_c)::text)"
"                                                                                                                                                                    Filter: (((coal_rights_yn)::text = 'Y'::text) AND ((ownership_category_f)::text = ANY ('{LEASED,OPTION,OWNED}'::text[])))"
"                                                                                                                                                                    Rows Removed by Filter: 0"
"                                                                                                                                                        ->  Index Scan using proprights_prop_idx on lms_doc_property_rights_assoc lms_doc_property_rights_assoc_3  (cost=0.41..0.51 rows=1 width=36) (actual time=0.007..0.007 rows=1 loops=205)"
"                                                                                                                                                              Index Cond: ((property_sid_c)::text = (lms_property_rights_base_3.property_sid_k)::text)"
"                                                                                                                                                  ->  Index Scan using so_seam_base_pkey on so_seam_base  (cost=0.28..0.31 rows=1 width=22) (actual time=0.004..0.004 rows=1 loops=205)"
"                                                                                                                                                        Index Cond: ((seam_sid_k)::text = (lms_prop_rights_seam_assoc_1.seam_sid_c)::text)"
"                                                                                                                                            ->  Index Only Scan using lms_prop_up_assoc_pkey on lms_prop_up_assoc lms_prop_up_assoc_3  (cost=0.42..0.98 rows=23 width=33) (actual time=0.009..0.011 rows=6 loops=205)"
"                                                                                                                                                  Index Cond: (property_sid_c = (lms_doc_property_rights_assoc_3.property_sid_c)::text)"
"                                                                                                                                                  Heap Fetches: 1164"
"                                                                                                                                      ->  Index Only Scan using lms_up_seam_reserve_assoc_up_sid_c_seam_sid_c_key on lms_up_seam_reserve_assoc lms_up_seam_reserve_assoc_4  (cost=0.42..0.50 rows=4 width=29) (actual time=0.007..0.009 rows=5 loops=1164)"
"                                                                                                                                            Index Cond: (up_sid_c = (lms_prop_up_assoc_3.up_sid_c)::text)"
"                                                                                                                                            Heap Fetches: 5303"
"                                                                                                                                ->  Hash  (cost=71.86..71.86 rows=2986 width=25) (actual time=1.384..1.384 rows=2986 loops=1)"
"                                                                                                                                      Buckets: 4096  Batches: 1  Memory Usage: 201kB"
"                                                                                                                                      ->  Seq Scan on so_seam_base so_seam_base_1  (cost=0.00..71.86 rows=2986 width=25) (actual time=0.016..0.615 rows=2986 loops=1)"
"                                                                                                                          ->  Hash Join  (cost=269.87..827.58 rows=19 width=125) (actual time=1.428..24.152 rows=2738 loops=1)"
"                                                                                                                                Hash Cond: (((lms_property_rights_base_4.state_code_f)::text = (so_seam_base_3.state_f)::text) AND ((lms_up_seam_reserve_assoc_5.seam_sid_c)::text = (so_seam_base_3.seam_sid_k)::text))"
"                                                                                                                                Join Filter: (so_seam_base_3.seam_order <= so_seam_base_2.seam_order)"
"                                                                                                                                Rows Removed by Join Filter: 2370"
"                                                                                                                                ->  Nested Loop  (cost=153.22..703.33 rows=1448 width=133) (actual time=0.401..21.348 rows=5108 loops=1)"
"                                                                                                                                      ->  Nested Loop  (cost=152.80..507.12 rows=362 width=119) (actual time=0.388..9.908 rows=1467 loops=1)"
"                                                                                                                                            Join Filter: ((lms_property_rights_base_4.property_sid_k)::text = (lms_prop_up_assoc_4.property_sid_c)::text)"
"                                                                                                                                            ->  Nested Loop  (cost=152.38..450.30 rows=45 width=162) (actual time=0.372..7.193 rows=238 loops=1)"
"                                                                                                                                                  ->  Nested Loop  (cost=152.10..436.56 rows=45 width=168) (actual time=0.358..5.970 rows=238 loops=1)"
"                                                                                                                                                        ->  Nested Loop  (cost=151.69..413.24 rows=45 width=132) (actual time=0.344..4.224 rows=238 loops=1)"
"                                                                                                                                                              Join Filter: ((lms_coal_property_rights_base_4.property_sid_c)::text = (lms_property_rights_base_4.property_sid_k)::text)"
"                                                                                                                                                              ->  Hash Join  (cost=151.27..314.66 rows=177 width=76) (actual time=0.326..1.659 rows=352 loops=1)"
"                                                                                                                                                                    Hash Cond: ((lms_prop_rights_seam_assoc_2.property_sid_c)::text = (lms_coal_property_rights_base_4.property_sid_c)::text)"
"                                                                                                                                                                    ->  Seq Scan on lms_prop_rights_seam_assoc lms_prop_rights_seam_assoc_2  (cost=0.00..142.92 rows=7792 width=33) (actual time=0.005..0.527 rows=7792 loops=1)"
"                                                                                                                                                                    ->  Hash  (cost=146.87..146.87 rows=352 width=43) (actual time=0.305..0.306 rows=352 loops=1)"
"                                                                                                                                                                          Buckets: 1024  Batches: 1  Memory Usage: 34kB"
"                                                                                                                                                                          ->  Index Scan using coal_prop_rights_howtouse_idx on lms_coal_property_rights_base lms_coal_property_rights_base_4  (cost=0.29..146.87 rows=352 width=43) (actual time=0.023..0.176 rows=352 loops=1)"
"                                                                                                                                                                                Index Cond: ((how_to_use_seam_assoc_f)::text = 'ABOVEINCLUDING'::text)"
"                                                                                                                                                              ->  Index Scan using lms_property_rights_base_pkey on lms_property_rights_base lms_property_rights_base_4  (cost=0.41..0.54 rows=1 width=56) (actual time=0.007..0.007 rows=1 loops=352)"
"                                                                                                                                                                    Index Cond: ((property_sid_k)::text = (lms_prop_rights_seam_assoc_2.property_sid_c)::text)"
"                                                                                                                                                                    Filter: (((coal_rights_yn)::text = 'Y'::text) AND ((ownership_category_f)::text = ANY ('{LEASED,OPTION,OWNED}'::text[])))"
"                                                                                                                                                                    Rows Removed by Filter: 0"
"                                                                                                                                                        ->  Index Scan using proprights_prop_idx on lms_doc_property_rights_assoc lms_doc_property_rights_assoc_4  (cost=0.41..0.51 rows=1 width=36) (actual time=0.006..0.007 rows=1 loops=238)"
"                                                                                                                                                              Index Cond: ((property_sid_c)::text = (lms_property_rights_base_4.property_sid_k)::text)"
"                                                                                                                                                  ->  Index Scan using so_seam_base_pkey on so_seam_base so_seam_base_2  (cost=0.28..0.31 rows=1 width=22) (actual time=0.004..0.004 rows=1 loops=238)"
"                                                                                                                                                        Index Cond: ((seam_sid_k)::text = (lms_prop_rights_seam_assoc_2.seam_sid_c)::text)"
"                                                                                                                                            ->  Index Only Scan using lms_prop_up_assoc_pkey on lms_prop_up_assoc lms_prop_up_assoc_4  (cost=0.42..0.98 rows=23 width=33) (actual time=0.008..0.010 rows=6 loops=238)"
"                                                                                                                                                  Index Cond: (property_sid_c = (lms_doc_property_rights_assoc_4.property_sid_c)::text)"
"                                                                                                                                                  Heap Fetches: 1467"
"                                                                                                                                      ->  Index Only Scan using lms_up_seam_reserve_assoc_up_sid_c_seam_sid_c_key on lms_up_seam_reserve_assoc lms_up_seam_reserve_assoc_5  (cost=0.42..0.50 rows=4 width=29) (actual time=0.006..0.007 rows=3 loops=1467)"
"                                                                                                                                            Index Cond: (up_sid_c = (lms_prop_up_assoc_4.up_sid_c)::text)"
"                                                                                                                                            Heap Fetches: 5108"
"                                                                                                                                ->  Hash  (cost=71.86..71.86 rows=2986 width=25) (actual time=0.979..0.979 rows=2986 loops=1)"
"                                                                                                                                      Buckets: 4096  Batches: 1  Memory Usage: 201kB"
"                                                                                                                                      ->  Seq Scan on so_seam_base so_seam_base_3  (cost=0.00..71.86 rows=2986 width=25) (actual time=0.012..0.404 rows=2986 loops=1)"
"                                                                                                                          ->  Hash Join  (cost=248.22..707.80 rows=14 width=125) (actual time=1.320..22.266 rows=1677 loops=1)"
"                                                                                                                                Hash Cond: (((lms_property_rights_base_5.state_code_f)::text = (so_seam_base_5.state_f)::text) AND ((lms_up_seam_reserve_assoc_6.seam_sid_c)::text = (so_seam_base_5.seam_sid_k)::text))"
"                                                                                                                                Join Filter: (so_seam_base_5.seam_order > so_seam_base_4.seam_order)"
"                                                                                                                                Rows Removed by Join Filter: 3777"
"                                                                                                                                ->  Nested Loop  (cost=131.57..585.42 rows=1091 width=133) (actual time=0.297..19.411 rows=5454 loops=1)"
"                                                                                                                                      ->  Nested Loop  (cost=131.15..437.46 rows=273 width=119) (actual time=0.284..8.623 rows=1374 loops=1)"
"                                                                                                                                            Join Filter: ((lms_property_rights_base_5.property_sid_k)::text = (lms_prop_up_assoc_5.property_sid_c)::text)"
"                                                                                                                                            ->  Nested Loop  (cost=130.73..394.53 rows=34 width=162) (actual time=0.265..6.118 rows=242 loops=1)"
"                                                                                                                                                  ->  Nested Loop  (cost=130.45..384.14 rows=34 width=168) (actual time=0.256..4.968 rows=242 loops=1)"
"                                                                                                                                                        ->  Nested Loop  (cost=130.03..366.53 rows=34 width=132) (actual time=0.241..3.322 rows=242 loops=1)"
"                                                                                                                                                              Join Filter: ((lms_coal_property_rights_base_5.property_sid_c)::text = (lms_property_rights_base_5.property_sid_k)::text)"
"                                                                                                                                                              ->  Hash Join  (cost=129.62..293.00 rows=132 width=76) (actual time=0.225..1.382 rows=264 loops=1)"
"                                                                                                                                                                    Hash Cond: ((lms_prop_rights_seam_assoc_3.property_sid_c)::text = (lms_coal_property_rights_base_5.property_sid_c)::text)"
"                                                                                                                                                                    ->  Seq Scan on lms_prop_rights_seam_assoc lms_prop_rights_seam_assoc_3  (cost=0.00..142.92 rows=7792 width=33) (actual time=0.004..0.398 rows=7792 loops=1)"
"                                                                                                                                                                    ->  Hash  (cost=126.32..126.32 rows=264 width=43) (actual time=0.209..0.209 rows=264 loops=1)"
"                                                                                                                                                                          Buckets: 1024  Batches: 1  Memory Usage: 26kB"
"                                                                                                                                                                          ->  Index Scan using coal_prop_rights_howtouse_idx on lms_coal_property_rights_base lms_coal_property_rights_base_5  (cost=0.29..126.32 rows=264 width=43) (actual time=0.012..0.120 rows=264 loops=1)"
"                                                                                                                                                                                Index Cond: ((how_to_use_seam_assoc_f)::text = 'ALLBELOW'::text)"
"                                                                                                                                                              ->  Index Scan using lms_property_rights_base_pkey on lms_property_rights_base lms_property_rights_base_5  (cost=0.41..0.54 rows=1 width=56) (actual time=0.007..0.007 rows=1 loops=264)"
"                                                                                                                                                                    Index Cond: ((property_sid_k)::text = (lms_prop_rights_seam_assoc_3.property_sid_c)::text)"
"                                                                                                                                                                    Filter: (((coal_rights_yn)::text = 'Y'::text) AND ((ownership_category_f)::text = ANY ('{LEASED,OPTION,OWNED}'::text[])))"
"                                                                                                                                                                    Rows Removed by Filter: 0"
"                                                                                                                                                        ->  Index Scan using proprights_prop_idx on lms_doc_property_rights_assoc lms_doc_property_rights_assoc_5  (cost=0.41..0.51 rows=1 width=36) (actual time=0.006..0.006 rows=1 loops=242)"
"                                                                                                                                                              Index Cond: ((property_sid_c)::text = (lms_property_rights_base_5.property_sid_k)::text)"
"                                                                                                                                                  ->  Index Scan using so_seam_base_pkey on so_seam_base so_seam_base_4  (cost=0.28..0.31 rows=1 width=22) (actual time=0.004..0.004 rows=1 loops=242)"
"                                                                                                                                                        Index Cond: ((seam_sid_k)::text = (lms_prop_rights_seam_assoc_3.seam_sid_c)::text)"
"                                                                                                                                            ->  Index Only Scan using lms_prop_up_assoc_pkey on lms_prop_up_assoc lms_prop_up_assoc_5  (cost=0.42..0.98 rows=23 width=33) (actual time=0.007..0.009 rows=6 loops=242)"
"                                                                                                                                                  Index Cond: (property_sid_c = (lms_doc_property_rights_assoc_5.property_sid_c)::text)"
"                                                                                                                                                  Heap Fetches: 1374"
"                                                                                                                                      ->  Index Only Scan using lms_up_seam_reserve_assoc_up_sid_c_seam_sid_c_key on lms_up_seam_reserve_assoc lms_up_seam_reserve_assoc_6  (cost=0.42..0.50 rows=4 width=29) (actual time=0.006..0.007 rows=4 loops=1374)"
"                                                                                                                                            Index Cond: (up_sid_c = (lms_prop_up_assoc_5.up_sid_c)::text)"
"                                                                                                                                            Heap Fetches: 5455"
"                                                                                                                                ->  Hash  (cost=71.86..71.86 rows=2986 width=25) (actual time=0.946..0.946 rows=2986 loops=1)"
"                                                                                                                                      Buckets: 4096  Batches: 1  Memory Usage: 201kB"
"                                                                                                                                      ->  Seq Scan on so_seam_base so_seam_base_5  (cost=0.00..71.86 rows=2986 width=25) (actual time=0.008..0.422 rows=2986 loops=1)"
"                                                                                                                          ->  Hash Join  (cost=196.38..496.11 rows=7 width=125) (actual time=1.241..19.966 rows=2246 loops=1)"
"                                                                                                                                Hash Cond: (((lms_property_rights_base_6.state_code_f)::text = (so_seam_base_7.state_f)::text) AND ((lms_up_seam_reserve_assoc_7.seam_sid_c)::text = (so_seam_base_7.seam_sid_k)::text))"
"                                                                                                                                Join Filter: (so_seam_base_7.seam_order >= so_seam_base_6.seam_order)"
"                                                                                                                                Rows Removed by Join Filter: 1363"
"                                                                                                                                ->  Nested Loop  (cost=79.73..376.81 rows=505 width=133) (actual time=0.228..17.326 rows=3609 loops=1)"
"                                                                                                                                      ->  Nested Loop  (cost=79.31..308.52 rows=126 width=119) (actual time=0.210..6.704 rows=1059 loops=1)"
"                                                                                                                                            Join Filter: ((lms_property_rights_base_6.property_sid_k)::text = (lms_prop_up_assoc_6.property_sid_c)::text)"
"                                                                                                                                            ->  Nested Loop  (cost=78.89..288.32 rows=16 width=162) (actual time=0.185..4.899 rows=109 loops=1)"
"                                                                                                                                                  ->  Nested Loop  (cost=78.61..283.43 rows=16 width=168) (actual time=0.175..4.001 rows=109 loops=1)"
"                                                                                                                                                        ->  Nested Loop  (cost=78.19..275.14 rows=16 width=132) (actual time=0.163..2.886 rows=109 loops=1)"
"                                                                                                                                                              Join Filter: ((lms_coal_property_rights_base_6.property_sid_c)::text = (lms_property_rights_base_6.property_sid_k)::text)"
"                                                                                                                                                              ->  Hash Join  (cost=77.78..241.16 rows=61 width=76) (actual time=0.145..1.573 rows=122 loops=1)"
"                                                                                                                                                                    Hash Cond: ((lms_prop_rights_seam_assoc_4.property_sid_c)::text = (lms_coal_property_rights_base_6.property_sid_c)::text)"
"                                                                                                                                                                    ->  Seq Scan on lms_prop_rights_seam_assoc lms_prop_rights_seam_assoc_4  (cost=0.00..142.92 rows=7792 width=33) (actual time=0.006..0.581 rows=7792 loops=1)"
"                                                                                                                                                                    ->  Hash  (cost=76.25..76.25 rows=122 width=43) (actual time=0.104..0.105 rows=122 loops=1)"
"                                                                                                                                                                          Buckets: 1024  Batches: 1  Memory Usage: 17kB"
"                                                                                                                                                                          ->  Index Scan using coal_prop_rights_howtouse_idx on lms_coal_property_rights_base lms_coal_property_rights_base_6  (cost=0.29..76.25 rows=122 width=43) (actual time=0.013..0.079 rows=122 loops=1)"
"                                                                                                                                                                                Index Cond: ((how_to_use_seam_assoc_f)::text = 'BELOWINCLUDING'::text)"
"                                                                                                                                                              ->  Index Scan using lms_property_rights_base_pkey on lms_property_rights_base lms_property_rights_base_6  (cost=0.41..0.54 rows=1 width=56) (actual time=0.009..0.009 rows=1 loops=122)"
"                                                                                                                                                                    Index Cond: ((property_sid_k)::text = (lms_prop_rights_seam_assoc_4.property_sid_c)::text)"
"                                                                                                                                                                    Filter: (((coal_rights_yn)::text = 'Y'::text) AND ((ownership_category_f)::text = ANY ('{LEASED,OPTION,OWNED}'::text[])))"
"                                                                                                                                                                    Rows Removed by Filter: 0"
"                                                                                                                                                        ->  Index Scan using proprights_prop_idx on lms_doc_property_rights_assoc lms_doc_property_rights_assoc_6  (cost=0.41..0.51 rows=1 width=36) (actual time=0.009..0.009 rows=1 loops=109)"
"                                                                                                                                                              Index Cond: ((property_sid_c)::text = (lms_property_rights_base_6.property_sid_k)::text)"
"                                                                                                                                                  ->  Index Scan using so_seam_base_pkey on so_seam_base so_seam_base_6  (cost=0.28..0.31 rows=1 width=22) (actual time=0.006..0.006 rows=1 loops=109)"
"                                                                                                                                                        Index Cond: ((seam_sid_k)::text = (lms_prop_rights_seam_assoc_4.seam_sid_c)::text)"
"                                                                                                                                            ->  Index Only Scan using lms_prop_up_assoc_pkey on lms_prop_up_assoc lms_prop_up_assoc_6  (cost=0.42..0.98 rows=23 width=33) (actual time=0.010..0.013 rows=10 loops=109)"
"                                                                                                                                                  Index Cond: (property_sid_c = (lms_doc_property_rights_assoc_6.property_sid_c)::text)"
"                                                                                                                                                  Heap Fetches: 1059"
"                                                                                                                                      ->  Index Only Scan using lms_up_seam_reserve_assoc_up_sid_c_seam_sid_c_key on lms_up_seam_reserve_assoc lms_up_seam_reserve_assoc_7  (cost=0.42..0.50 rows=4 width=29) (actual time=0.007..0.009 rows=3 loops=1059)"
"                                                                                                                                            Index Cond: (up_sid_c = (lms_prop_up_assoc_6.up_sid_c)::text)"
"                                                                                                                                            Heap Fetches: 3609"
"                                                                                                                                ->  Hash  (cost=71.86..71.86 rows=2986 width=25) (actual time=0.910..0.911 rows=2986 loops=1)"
"                                                                                                                                      Buckets: 4096  Batches: 1  Memory Usage: 201kB"
"                                                                                                                                      ->  Seq Scan on so_seam_base so_seam_base_7  (cost=0.00..71.86 rows=2986 width=25) (actual time=0.009..0.381 rows=2986 loops=1)"
"                                                                                                                          ->  Subquery Scan on ""*SELECT* 8""  (cost=0.00..0.00 rows=1 width=301) (actual time=0.001..0.001 rows=0 loops=1)"
"                                                                                                                                ->  Result  (cost=0.00..0.00 rows=0 width=297) (actual time=0.000..0.001 rows=0 loops=1)"
"                                                                                                                                      One-Time Filter: false"
"                                                                                                                    ->  Hash  (cost=571.61..571.61 rows=5354 width=36) (actual time=3.149..3.150 rows=5355 loops=1)"
"                                                                                                                          Buckets: 8192  Batches: 1  Memory Usage: 431kB"
"                                                                                                                          ->  Index Scan using idx_status_f on lms_doc_propright_status_assoc  (cost=0.29..571.61 rows=5354 width=36) (actual time=0.020..1.997 rows=5355 loops=1)"
"                                                                                                                                Index Cond: ((status_f)::text = 'ACQUIRED'::text)"
"                                                                                                              ->  Index Scan using lms_up_seam_reserve_assoc_up_sid_c_seam_sid_c_key on lms_up_seam_reserve_assoc  (cost=0.42..0.48 rows=1 width=46) (actual time=0.007..0.007 rows=1 loops=52841)"
"                                                                                                                    Index Cond: (((up_sid_c)::text = (lms_prop_up_assoc.up_sid_c)::text) AND ((seam_sid_c)::text = (lms_up_seam_reserve_assoc_1.seam_sid_c)::text))"
"                                                                                                                    Filter: ((lms_up_seam_status_f)::text = 'ACTIVE'::text)"
"                                                                                                                    Rows Removed by Filter: 0"
"                                                                                                        ->  Index Scan using lms_upseamreservearea_assoc_pkey on lms_upseamreservearea_assoc  (cost=0.42..0.46 rows=1 width=52) (actual time=0.007..0.007 rows=1 loops=51217)"
"                                                                                                              Index Cond: ((up_seam_reserve_sid_c)::text = (lms_up_seam_reserve_assoc.up_seam_reserve_sid_k)::text)"
"                                                                                                  ->  Index Only Scan using entity_base_pkey on entity_base  (cost=0.29..0.31 rows=1 width=16) (actual time=0.005..0.005 rows=1 loops=51096)"
"                                                                                                        Index Cond: (entity_sid_k = (lms_upseamreservearea_assoc.reserve_entity_sid_f)::text)"
"                                                                                                        Heap Fetches: 51096"
"                                                                                ->  Index Scan using lms_categorized_reserve_base_up_seam_reserve_sid_lf_reserve_key on lms_categorized_reserve_base  (cost=0.42..0.60 rows=2 width=64) (actual time=0.024..0.029 rows=1 loops=51096)"
"                                                                                      Index Cond: ((up_seam_reserve_sid_lf)::text = (lms_up_seam_reserve_assoc.up_seam_reserve_sid_k)::text)"
"                                                                                      Filter: (coal_acres > '0'::numeric)"
"                                                                                      Rows Removed by Filter: 2"
"                                                                          ->  HashAggregate  (cost=5501.99..5605.92 rows=10393 width=1818) (actual time=0.011..42.496 rows=58222 loops=49326)"
"                                                                                Group Key: ""*SELECT* 1"".reservecyclesid, ""*SELECT* 1"".upsid, ""*SELECT* 1"".countrycode, ""*SELECT* 1"".statecode, ""*SELECT* 1"".countyfip, ""*SELECT* 1"".upno, ""*SELECT* 1"".sec, ""*SELECT* 1"".twn, ""*SELECT* 1"".twn_ns, ""*SELECT* 1"".rng, ""*SELECT* 1"".rng_ew, ""*SELECT* 1"".acres, ""*SELECT* 1"".calcacres, ""*SELECT* 1"".srcecode, ""*SELECT* 1"".adddate, ""*SELECT* 1"".addempno, ""*SELECT* 1"".lastmoddate, ""*SELECT* 1"".lastmodempno, ""*SELECT* 1"".activeyn, ""*SELECT* 1"".inactdate, ""*SELECT* 1"".inactempno, ""*SELECT* 1"".lbllocx, ""*SELECT* 1"".lbllocy, ""*SELECT* 1"".lbllocsrce, ""*SELECT* 1"".verempno, ""*SELECT* 1"".verdate, ""*SELECT* 1"".bndverempno, ""*SELECT* 1"".bndverdate, ((""*SELECT* 1"".minx)::double precision), ""*SELECT* 1"".miny, ((""*SELECT* 1"".maxx)::double precision), ""*SELECT* 1"".maxy, ""*SELECT* 1"".modts, ""*SELECT* 1"".locationtext, ""*SELECT* 1"".remarks"
"                                                                                ->  Append  (cost=0.43..4592.60 rows=10393 width=1818) (actual time=170.661..380.695 rows=58222 loops=1)"
"                                                                                      ->  Subquery Scan on ""*SELECT* 1""  (cost=0.43..2.05 rows=1 width=291) (actual time=1.219..1.220 rows=0 loops=1)"
"                                                                                            ->  Index Scan using lms_up_cycle_base_pkey on lms_up_cycle_base  (cost=0.43..2.03 rows=1 width=295) (actual time=1.218..1.218 rows=0 loops=1)"
"                                                                                                  Index Cond: (reserve_cycle_sid_c IS NULL)"
"                                                                                      ->  Subquery Scan on ""*SELECT* 2""  (cost=3264.27..4538.59 rows=10392 width=570) (actual time=169.441..375.875 rows=58222 loops=1)"
"                                                                                            ->  Hash Join  (cost=3264.27..4226.83 rows=10392 width=360) (actual time=169.435..340.367 rows=58222 loops=1)"
"                                                                                                  Hash Cond: ((unit_property.up_sid_c)::text = (lms_up_base.up_sid_k)::text)"
"                                                                                                  ->  HashAggregate  (cost=833.55..1509.03 rows=10392 width=544) (actual time=114.847..239.655 rows=58224 loops=1)"
"                                                                                                        Group Key: unit_property.up_sid_c, unit_property.geometry, unit_property.mod_user, unit_property.updated_ts"
"                                                                                                        ->  Nested Loop  (cost=2.34..677.67 rows=10392 width=328) (actual time=0.125..43.217 rows=58224 loops=1)"
"                                                                                                              ->  Hash Join  (cost=1.92..6.59 rows=207 width=19) (actual time=0.074..0.233 rows=207 loops=1)"
"                                                                                                                    Hash Cond: ((state_county_coordinate_assoc.coordinate_system_c)::text = (lms_valid_coordinate_assoc.coordinate_system_k)::text)"
"                                                                                                                    ->  Seq Scan on state_county_coordinate_assoc  (cost=0.00..4.07 rows=207 width=20) (actual time=0.014..0.038 rows=207 loops=1)"
"                                                                                                                    ->  Hash  (cost=1.41..1.41 rows=41 width=17) (actual time=0.041..0.042 rows=41 loops=1)"
"                                                                                                                          Buckets: 1024  Batches: 1  Memory Usage: 10kB"
"                                                                                                                          ->  Seq Scan on lms_valid_coordinate_assoc  (cost=0.00..1.41 rows=41 width=17) (actual time=0.008..0.014 rows=41 loops=1)"
"                                                                                                              ->  Index Scan using idx_unit_property_multicolumn on unit_property  (cost=0.41..3.21 rows=3 width=331) (actual time=0.014..0.125 rows=281 loops=207)"
"                                                                                                                    Index Cond: (((country_code)::text = (state_county_coordinate_assoc.country_code_c)::text) AND ((county_fip)::text = (state_county_coordinate_assoc.county_fip_c)::text) AND ((state_code)::text = (state_county_coordinate_assoc.state_code_c)::text))"
"                                                                                                  ->  Hash  (cost=1673.65..1673.65 rows=60565 width=172) (actual time=54.512..54.513 rows=60565 loops=1)"
"                                                                                                        Buckets: 65536  Batches: 1  Memory Usage: 8683kB"
"                                                                                                        ->  Seq Scan on lms_up_base  (cost=0.00..1673.65 rows=60565 width=172) (actual time=0.017..25.277 rows=60565 loops=1)"
"                                                                    ->  Index Scan using so_country_state_assoc_lkup_pkey on so_country_state_assoc_lkup  (cost=0.14..1.55 rows=1 width=13) (actual time=0.018..0.019 rows=1 loops=48363)"
"                                                                          Index Cond: ((state_code_k)::text = (""*SELECT* 1"".statecode)::text)"
"                                                              ->  Index Only Scan using lms_reserve_category_lkup_pkey on lms_reserve_category_lkup  (cost=0.13..0.44 rows=1 width=2) (actual time=0.003..0.003 rows=0 loops=48363)"
"                                                                    Index Cond: ((reserve_category_k = lms_categorized_reserve_base.reserve_category_lf) AND (reserve_category_k = ANY ('{1,2,3}'::integer[])))"
"                                                                    Heap Fetches: 3897"
"                                                        ->  Index Only Scan using lms_reserve_minor_class_lkup_pkey on lms_reserve_minor_class_lkup  (cost=0.13..0.30 rows=1 width=3) (actual time=0.006..0.006 rows=1 loops=3897)"
"                                                              Index Cond: ((reserve_minor_class_k = (lms_categorized_reserve_base.reserve_minor_class_lf)::text) AND (reserve_minor_class_k = ANY ('{ID,MS}'::text[])))"
"                                                              Heap Fetches: 3867"
"                                                  ->  HashAggregate  (cost=473939.00..475929.94 rows=199094 width=594) (actual time=3.766..94.857 rows=166047 loops=3867)"
"                                                        Group Key: lms_catreserve_parmvalues_base.categorized_reserve_sid_c, sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'AdAsh'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'AdBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'AdMoisture'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'AdSulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryAsh'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DryBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'DrySulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'EqAsh'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'EqBTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'EqSulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'EquilibriumMoisture'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'Moisture'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'Sodium'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'W_Ash'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'W_BTU'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'W_Moisture'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'W_Sulfur'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END), sum(CASE WHEN ((lms_catreserve_parmvalues_base.parameter_code_c)::text = 'Total_Depth_Feet'::text) THEN (translate((lms_catreserve_parmvalues_base.parameter_value)::text, '1234567890+&<>!@#$%'::text, '1234567890'::text))::numeric ELSE '0'::numeric END)"
"                                                        ->  Finalize GroupAggregate  (cost=370240.97..464482.04 rows=199094 width=594) (actual time=10152.183..14085.640 rows=333656 loops=1)"
"                                                              Group Key: lms_catreserve_parmvalues_base.categorized_reserve_sid_c"
"                                                              ->  Gather Merge  (cost=370240.97..416699.48 rows=398188 width=594) (actual time=10152.130..10688.560 rows=474105 loops=1)"
"                                                                    Workers Planned: 2"
"                                                                    Workers Launched: 2"
"                                                                    ->  Sort  (cost=369240.95..369738.68 rows=199094 width=594) (actual time=9885.123..9901.666 rows=158035 loops=3)"
"                                                                          Sort Key: lms_catreserve_parmvalues_base.categorized_reserve_sid_c"
"                                                                          Sort Method: quicksort  Memory: 168383kB"
"                                                                          Worker 0:  Sort Method: quicksort  Memory: 164541kB"
"                                                                          Worker 1:  Sort Method: quicksort  Memory: 167022kB"
"                                                                          ->  Partial HashAggregate  (cost=340767.43..351717.60 rows=199094 width=594) (actual time=6733.792..8283.508 rows=158035 loops=3)"
"                                                                                Group Key: lms_catreserve_parmvalues_base.categorized_reserve_sid_c"
"                                                                                ->  Parallel Seq Scan on lms_catreserve_parmvalues_base  (cost=0.00..45016.06 rows=1300006 width=35) (actual time=0.333..2148.474 rows=1039995 loops=3)"
"                                            ->  HashAggregate  (cost=66.03..73.60 rows=757 width=912) (actual time=0.003..0.304 rows=756 loops=3867)"
"                                                  Group Key: lms_primary_subarea_base_cycle.reserve_cycle_sid_c, lms_primary_subarea_base_cycle.primarysubarea_sid_k, lms_primary_subarea_base_cycle.reserve_entity_sid_c, lms_primary_subarea_base_cycle.primary_subarea_name, lms_primary_subarea_base_cycle.primarysubarea_desc, lms_primary_subarea_base_cycle.reserve_mining_type_code_k, lms_primary_subarea_base_cycle.reserve_state_of_mining_code_k, (NULL::character varying), lms_primary_subarea_base_cycle.mod_ts, lms_primary_subarea_base_cycle.last_modified_by, lms_reserve_mining_type_lkup_1.mining_type_display"
"                                                  ->  Append  (cost=0.41..45.22 rows=757 width=912) (actual time=1.908..2.733 rows=756 loops=1)"
"                                                        ->  Nested Loop  (cost=0.41..3.45 rows=1 width=207) (actual time=1.729..1.729 rows=0 loops=1)"
"                                                              Join Filter: (lms_primary_subarea_base_cycle.reserve_mining_type_code_k = lms_reserve_mining_type_lkup_1.reserve_mining_type_code_k)"
"                                                              ->  Index Scan using lms_primary_subarea_base_cycle_pkey on lms_primary_subarea_base_cycle  (cost=0.41..2.38 rows=1 width=167) (actual time=1.727..1.727 rows=0 loops=1)"
"                                                                    Index Cond: (reserve_cycle_sid_c IS NULL)"
"                                                              ->  Seq Scan on lms_reserve_mining_type_lkup lms_reserve_mining_type_lkup_1  (cost=0.00..1.03 rows=3 width=10) (never executed)"
"                                                        ->  Hash Join  (cost=1.07..30.42 rows=756 width=196) (actual time=0.172..0.926 rows=756 loops=1)"
"                                                              Hash Cond: (lms_primary_subarea_base.reserve_mining_type_code_k = lms_reserve_mining_type_lkup_2.reserve_mining_type_code_k)"
"                                                              ->  Seq Scan on lms_primary_subarea_base  (cost=0.00..24.56 rows=756 width=156) (actual time=0.028..0.218 rows=756 loops=1)"
"                                                              ->  Hash  (cost=1.03..1.03 rows=3 width=10) (actual time=0.107..0.108 rows=3 loops=1)"
"                                                                    Buckets: 1024  Batches: 1  Memory Usage: 9kB"
"                                                                    ->  Seq Scan on lms_reserve_mining_type_lkup lms_reserve_mining_type_lkup_2  (cost=0.00..1.03 rows=3 width=10) (actual time=0.067..0.070 rows=3 loops=1)"
"                                      ->  Index Scan using lms_reserve_sec_report_assoc_pkey on lms_reserve_sec_report_assoc  (cost=0.27..0.29 rows=1 width=38) (actual time=0.027..0.027 rows=1 loops=3867)"
"                                            Index Cond: ((entity_base.entity_sid_k)::text = (reserve_entity_sid_c)::text)"
"                                ->  Index Scan using lms_reserve_sec_region_lkup_pkey on lms_reserve_sec_region_lkup  (cost=0.14..0.17 rows=1 width=31) (actual time=0.006..0.006 rows=1 loops=3867)"
"                                      Index Cond: ((lms_reserve_sec_report_assoc.reserve_sec_region_sid_lf)::text = (reserve_sec_region_sid_k)::text)"
"                          ->  Hash Left Join  (cost=2.30..25.76 rows=94 width=29) (actual time=0.011..0.163 rows=142 loops=3867)"
"                                Hash Cond: (lms_reserve_area_extension.reserve_mining_type_code_k = lms_reserve_mining_type_lkup.reserve_mining_type_code_k)"
"                                ->  Hash Join  (cost=1.23..24.10 rows=94 width=23) (actual time=0.009..0.136 rows=142 loops=3867)"
"                                      Hash Cond: (lms_reserve_area_extension.reserve_state_of_mining_code_k = lms_reserve_stateofmining_lkup.reserve_state_of_mining_code_k)"
"                                      ->  Seq Scan on lms_reserve_area_extension  (cost=0.00..21.38 rows=438 width=23) (actual time=0.004..0.062 rows=438 loops=3867)"
"                                      ->  Hash  (cost=1.19..1.19 rows=3 width=2) (actual time=0.037..0.038 rows=3 loops=1)"
"                                            Buckets: 1024  Batches: 1  Memory Usage: 9kB"
"                                            ->  Seq Scan on lms_reserve_stateofmining_lkup  (cost=0.00..1.19 rows=3 width=2) (actual time=0.031..0.034 rows=3 loops=1)"
"                                                  Filter: (reserve_state_of_mining_code_k = ANY ('{1,3,9}'::integer[]))"
"                                                  Rows Removed by Filter: 11"
"                                ->  Hash  (cost=1.03..1.03 rows=3 width=10) (actual time=0.012..0.012 rows=3 loops=1)"
"                                      Buckets: 1024  Batches: 1  Memory Usage: 9kB"
"                                      ->  Seq Scan on lms_reserve_mining_type_lkup  (cost=0.00..1.03 rows=3 width=10) (actual time=0.009..0.011 rows=3 loops=1)"
"Planning Time: 195.696 ms"
"Execution Time: 2696179.159 ms"

Attachment: query.sql
Description: query.sql


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux