explain.depesz.com

PostgreSQL's explain analyze made readable

Result: aEBP

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

Nested Loop Left Join (cost=40.20..58.23 rows=1 width=218) (actual rows= loops=)

  • Join Filter: (services.target_contractor_id = contractors.id)
  • Filter: ((contractors.tin IS NULL) OR (NOT (hashed SubPlan 3)))
2. 0.000 0.000 ↓ 0.0

Seq Scan on contractors (cost=0.00..3.22 rows=22 width=40) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=29.20..43.67 rows=1 width=90) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

HashAggregate (cost=10.50..10.90 rows=40 width=32) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=28.00..42.12 rows=1 width=168) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Limit (cost=1.20..1.54 rows=1 width=10) (actual rows= loops=)

  • Group Key: COALESCE(legal_entities.tin, ''::character varying)
7. 0.000 0.000 ↓ 0.0

Seq Scan on legal_entities (cost=0.00..10.40 rows=40 width=32) (actual rows= loops=)

  • Join Filter: (services.currency_id = related_currency.id)
8. 0.000 0.000 ↓ 0.0

Seq Scan on currencies related_currency (cost=0.00..1.04 rows=4 width=84) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Nested Loop (cost=28.00..41.03 rows=1 width=92) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Index Scan Backward using currencies_rates_currency_date_ukey on currencies_rates cr (cost=0.15..12.39 rows=36 width=10) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Seq Scan on currencies (cost=0.00..1.05 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((currency_id = $3) AND (currency_day <= CASE WHEN ((related_currency.currency)::text = 'rub'::text) THEN services.render_ended_at ELSE currencies_rates.currency_day END))
12. 0.000 0.000 ↓ 0.0

Index Scan using projects_pkey on projects (cost=0.28..8.29 rows=1 width=24) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=27.73..32.71 rows=1 width=76) (actual rows= loops=)

  • Filter: ((index)::text = 'usd'::text)
  • Index Cond: (id = services.project_id)
  • Hash Cond: (currencies_rates.rate_id = services.currency_rate_id)
14. 0.000 0.000 ↓ 0.0

Seq Scan on currencies_rates (cost=0.00..4.16 rows=216 width=14) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Hash (cost=27.72..27.72 rows=1 width=70) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Seq Scan on services (cost=13.72..27.72 rows=1 width=70) (actual rows= loops=)

  • Filter: ((deleted_at IS NULL) AND ((expenditure_id IS NULL) OR (NOT (hashed SubPlan 1))) AND ((nomenclature_id IS NULL) OR (NOT (hashed SubPlan 2))) AND ('[2020-07-01,2020-08-01)'::daterange && daterange(render_started_at, render_ended_at, '[]'::text)) AND (project_id = ANY ('{236,362,117,621}'::bigint[])))
17.          

SubPlan (for Seq Scan)

18. 0.000 0.000 ↓ 0.0

Seq Scan on nomenclatures_products (cost=0.00..6.88 rows=1 width=8) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Seq Scan on expenditures (cost=0.00..6.84 rows=1 width=8) (actual rows= loops=)

  • Filter: ((index)::text = ANY ('{properties,profits_distribution}'::text[]))
  • Filter: ((index)::text = 'properties'::text)