QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Group (cost=4635.58..4635.60 rows=1 width=540) -> Sort (cost=4635.58..4635.59 rows=1 width=540) Sort Key: cp.id, c.id, qe.entered, cp.name, qpof.value -> Nested Loop (cost=1688.95..4635.57 rows=1 width=540) -> Nested Loop (cost=1688.95..4629.74 rows=1 width=1052) -> Hash Join (cost=1688.95..4626.71 rows=1 width=1048) Hash Cond: ((CASE WHEN (("outer".category_name)::text = 'Granite'::text) THEN 'Materials'::character varying ELSE "outer".category_name END)::text = ("inner".name)::text) Join Filter: ((("inner".name)::text = "replace"(("outer".product_name)::text, '_'::text, ' '::text)) OR (("inner".name)::text = ("replace"(("outer".product_name)::text, '_'::text, ' '::text) || regexp_replace(("outer".option_name)::text, '^.*?([[:digit:]]+).*$'::text, E' \\\\1.0mm'::text)))) -> Hash IN Join (cost=1667.15..4603.59 rows=72 width=1577) Hash Cond: ("outer".category_id = "inner".category_id) -> Hash Left Join (cost=1665.66..4583.29 rows=3619 width=1585) Hash Cond: ("outer".parent_id = "inner".category_id) -> Hash Join (cost=1664.36..4527.70 rows=3619 width=1073) Hash Cond: ("outer".product_id = "inner".product_id) -> Hash Join (cost=1657.42..4466.48 rows=3619 width=561) Hash Cond: ("outer".product_option_id = "inner".product_option_id) -> Hash Join (cost=1621.83..4376.60 rows=3619 width=544) Hash Cond: ("outer".quote_product_option_id = "inner".quote_product_option_id) -> Hash Join (cost=1023.99..3051.24 rows=3619 width=540) Hash Cond: ("outer".product_id = "inner".product_id) -> Hash Join (cost=1015.96..2750.62 rows=25667 width=16) Hash Cond: ("outer".item_id = "inner".item_id) -> Seq Scan on quote_product_options qpo (cost=0.00..521.67 rows=25667 width=12) -> Hash (cost=766.97..766.97 rows=33597 width=12) -> Seq Scan on ccrm_quote_product cqp (cost=0.00..766.97 rows=33597 width=12) -> Hash (cost=7.96..7.96 rows=28 width=532) -> Hash Join (cost=4.94..7.96 rows=28 width=532) Hash Cond: ("outer".category_id = "inner".category_id) -> Seq Scan on product_category pcat (cost=0.00..1.24 rows=24 width=524) -> Hash (cost=4.35..4.35 rows=235 width=8) -> Seq Scan on product_catalog_category_map pccm (cost=0.00..4.35 rows=235 width=8) -> Hash (cost=407.67..407.67 rows=25667 width=12) -> Seq Scan on quote_product_option_float qpof (cost=0.00..407.67 rows=25667 width=12) -> Hash (cost=34.18..34.18 rows=564 width=25) -> Hash Join (cost=11.05..34.18 rows=564 width=25) Hash Cond: ("outer".option_id = "inner".option_id) -> Seq Scan on product_option po (cost=0.00..14.66 rows=566 width=21) -> Hash (cost=9.64..9.64 rows=564 width=12) -> Seq Scan on product_option_map pom (cost=0.00..9.64 rows=564 width=12) -> Hash (cost=6.35..6.35 rows=235 width=520) -> Seq Scan on product_catalog pc (cost=0.00..6.35 rows=235 width=520) -> Hash (cost=1.24..1.24 rows=24 width=520) -> Seq Scan on product_category ppcat (cost=0.00..1.24 rows=24 width=520) -> Hash (cost=1.48..1.48 rows=4 width=4) -> Seq Scan on product_category (cost=0.00..1.48 rows=4 width=4) Filter: (((category_name)::text = 'Cutouts'::text) OR ((category_name)::text = 'Polishing'::text) OR ((category_name)::text = 'Materials'::text) OR ((category_name)::text = 'Granite'::text)) -> Hash (cost=21.73..21.73 rows=30 width=1036) -> Hash Join (cost=10.38..21.73 rows=30 width=1036) Hash Cond: ("outer".id = "inner".product_section_id) -> Seq Scan on product_section ps (cost=0.00..10.70 rows=70 width=520) -> Hash (cost=10.30..10.30 rows=30 width=524) -> Seq Scan on catalog_product cp (cost=0.00..10.30 rows=30 width=524) -> Index Scan using quote_entry_pkey on quote_entry qe (cost=0.00..3.02 rows=1 width=12) Index Cond: ("outer".quote_id = qe.quote_id) -> Index Scan using company_name_index on company c (cost=0.00..5.82 rows=1 width=520) Index Cond: ((COALESCE("outer".category_name, 'Akmens Namai'::character varying))::text = (c.name)::text) (56 filas)