explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7rft

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=24,108.79..24,108.80 rows=15 width=1,873) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Sort (cost=24,108.79..24,108.81 rows=43 width=1,873) (actual rows= loops=)

  • Sort Key: (CASE WHEN ((assets_table.asset_miles > '-1'::integer) AND (assets_table.priority__c IS NOT NULL) AND (((assets_table.billing_state_code__c)::text = 'TX'::text) OR (NOT assets_table.state_priority)) AND (assets_table.show_on_homepage__c IS TRUE)) THEN CASE WHEN ((assets_table.asset_miles <= assets_table.priority_towable_miles) AND ((assets_table.class_category__c)::text = 'Towable'::text)) THEN assets_table.priority__c WHEN ((assets_table.asset_miles <= assets_table.priority_motorized_miles) AND ((assets_table.class_category__c)::text = 'Motorized'::text)) THEN assets_table.priority__c ELSE '999'::double precision END ELSE '999'::double precision END), (CASE WHEN ((assets_table.campaign__c IS NOT NULL) AND (assets_table.show_on_homepage__c IS FALSE)) THEN concat(to_char(assets_table.asset_miles, 'fm000000'::text), 'B') WHEN (assets_table.show_on_homepage__c IS TRUE) THEN concat(to_char(assets_table.asset_miles, 'fm000000'::text), 'A') ELSE concat('Z', to_char(assets_table.asset_miles, 'fm000000'::text)) END), assets_table.asset_miles, assets_table.stock_number__c
3. 0.000 0.000 ↓ 0.0

Subquery Scan on assets_table (cost=17.27..24,108.58 rows=43 width=1,873) (actual rows= loops=)

  • Filter: (CASE WHEN ((assets_table.campaign__c IS NOT NULL) AND (assets_table.show_on_homepage__c IS FALSE)) THEN concat(to_char(assets_table.asset_miles, 'fm000000'::text), 'B') WHEN (assets_table.show_on_homepage__c IS TRUE) THEN concat(to_char(assets_table.asset_miles, 'fm000000'::text), 'A') ELSE concat('Z', to_char(assets_table.asset_miles, 'fm000000'::text)) END !~~ '%Z'::text)
4. 0.000 0.000 ↓ 0.0

WindowAgg (cost=17.27..24,107.97 rows=54 width=1,833) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=17.27..24,107.32 rows=54 width=1,785) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.19..23,826.34 rows=54 width=1,456) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.14..23,771.37 rows=54 width=1,153) (actual rows= loops=)

  • Join Filter: (((master_account_website.account_sfid)::text = (asset.accountid)::text) AND ((master_account_website_domain_mapping.show_used_assets AND ((asset.condition__c)::text = 'Used'::text)) OR (master_account_website_domain_mapping.show_new_assets AND ((asset.condition__c)::text = 'New'::text))))
8. 0.000 0.000 ↓ 0.0

Hash Join (cost=17.03..165.14 rows=160 width=252) (actual rows= loops=)

  • Hash Cond: ((master_account_website.gl_code)::text = (master_account_website_domain_mapping.gl_code)::text)
9. 0.000 0.000 ↓ 0.0

Hash Join (cost=4.26..151.60 rows=161 width=253) (actual rows= loops=)

  • Hash Cond: ((account.sfid)::text = (master_account_website.account_sfid)::text)
10. 0.000 0.000 ↓ 0.0

Seq Scan on account (cost=0.00..146.53 rows=438 width=179) (actual rows= loops=)

  • Filter: (isdeleted = 0)
11. 0.000 0.000 ↓ 0.0

Hash (cost=3.70..3.70 rows=161 width=74) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Seq Scan on master_account_website (cost=0.00..3.70 rows=161 width=74) (actual rows= loops=)

  • Filter: (((account_sfid)::text <> ''::text) AND (status_id = 2))
13. 0.000 0.000 ↓ 0.0

Hash (cost=12.17..12.17 rows=173 width=5) (actual rows= loops=)