explain.depesz.com

PostgreSQL's explain analyze made readable

Result: mvrw

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

Limit (cost=1,008.57..1,008.58 rows=1 width=121) (actual time=0.008..0.008 rows=0 loops=1)

2. 0.003 0.008 ↓ 0.0 0 1

Sort (cost=1,008.57..1,008.58 rows=1 width=121) (actual time=0.008..0.008 rows=0 loops=1)

  • Sort Key: v0_.id
  • Sort Method: quicksort Memory: 25kB
3. 0.000 0.005 ↓ 0.0 0 1

Nested Loop (cost=765.15..1,008.56 rows=1 width=121) (actual time=0.005..0.005 rows=0 loops=1)

  • Join Filter: ((c1_.contractor_company_id = v0_.company_id) OR (c1_.contractor_person_id = v0_.person_id))
4. 0.000 0.005 ↓ 0.0 0 1

Nested Loop (cost=0.57..16.61 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=1)

5. 0.005 0.005 ↓ 0.0 0 1

Index Scan using contractors_groups_pkey on contractors_groups c3_ (cost=0.29..8.30 rows=1 width=4) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: (id = 52)
6. 0.000 0.000 ↓ 0.0 0

Index Scan using contractors_companies_pkey on contractors_companies c1_ (cost=0.29..8.30 rows=1 width=12) (never executed)

  • Index Cond: (id = c3_.contractor_id)
  • Filter: (status_id = 1)
7. 0.000 0.000 ↓ 0.0 0

Subquery Scan on v0_ (cost=764.58..991.38 rows=38 width=121) (never executed)

  • Filter: (v0_.is_active AND ((v0_.external_type IS NULL) OR (v0_.external_type = ANY ('{1,2}'::integer[]))))
8. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=764.58..928.38 rows=5,040 width=121) (never executed)

9. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=764.58..814.98 rows=5,040 width=113) (never executed)

  • Group Key: (NULL::integer), d.id, d.company_id, ('division'::text), ((((co.name)::text || ', '::text) || CASE WHEN (d.id = co.head_division_id) THEN (('ИНН: '::text || (co.inn)::text) || COALESCE((', ОГРН:'::text || (co.ogrn)::text), ''::text)) ELSE ((d.title)::text || COALESCE((', КПП: '::text || (d.kpp)::text), ''::text)) END)), ((((co.name)::text || ((co.head_division_id <> d.id))::text) || (d.title)::text)), co.is_active, co.external_type
10. 0.000 0.000 ↓ 0.0 0

Append (cost=322.10..663.78 rows=5,040 width=113) (never executed)

11. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=322.10..551.86 rows=4,069 width=113) (never executed)

  • Hash Cond: (d.company_id = co.id)
12. 0.000 0.000 ↓ 0.0 0

Seq Scan on divisions d (cost=0.00..96.94 rows=4,094 width=44) (never executed)

  • Filter: is_visible
13. 0.000 0.000 ↓ 0.0 0

Hash (cost=272.67..272.67 rows=3,954 width=135) (never executed)

14. 0.000 0.000 ↓ 0.0 0

Seq Scan on companies co (cost=0.00..272.67 rows=3,954 width=135) (never executed)

  • Filter: (is_active AND (type_id = ANY ('{2,3}'::integer[])) AND (step_id = 3))
15. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.15..36.32 rows=971 width=113) (never executed)

16. 0.000 0.000 ↓ 0.0 0

Seq Scan on persons p (cost=0.00..1.07 rows=4 width=101) (never executed)

  • Filter: is_active
17. 0.000 0.000 ↓ 0.0 0

Index Only Scan using natural_entities_person_idx on natural_entities ne (cost=0.15..5.17 rows=1 width=4) (never executed)

  • Index Cond: (person_id = p.id)
  • Heap Fetches: 0
Planning time : 0.598 ms
Execution time : 0.094 ms