explain.depesz.com

PostgreSQL's explain analyze made readable

Result: oav7

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.743 8.813 ↓ 26.4 211 1

Sort (cost=137.97..137.99 rows=8 width=781) (actual time=8.801..8.813 rows=211 loops=1)

  • Sort Key: con.forename
  • Sort Method: quicksort Memory: 872kB
2.          

Initplan (for Sort)

3. 0.004 0.004 ↑ 1.0 1 1

Seq Scan on groups_clients groups_clients_1 (cost=0.00..1.40 rows=1 width=4) (actual time=0.002..0.004 rows=1 loops=1)

  • Filter: (client_alias_id = 25)
  • Rows Removed by Filter: 31
4. 3.240 8.066 ↓ 26.4 211 1

Nested Loop Left Join (cost=3.46..136.45 rows=8 width=781) (actual time=0.119..8.066 rows=211 loops=1)

5. 0.072 2.716 ↓ 26.4 211 1

Nested Loop Left Join (cost=2.11..124.41 rows=8 width=2,039) (actual time=0.064..2.716 rows=211 loops=1)

6. 0.087 1.167 ↓ 26.4 211 1

Nested Loop Left Join (cost=2.11..17.91 rows=8 width=2,007) (actual time=0.052..1.167 rows=211 loops=1)

7. 0.073 0.869 ↓ 26.4 211 1

Nested Loop Left Join (cost=1.83..14.40 rows=8 width=1,971) (actual time=0.044..0.869 rows=211 loops=1)

8. 0.165 0.585 ↓ 26.4 211 1

Nested Loop (cost=1.56..10.21 rows=8 width=1,932) (actual time=0.041..0.585 rows=211 loops=1)

9. 0.140 0.209 ↓ 26.4 211 1

Hash Join (cost=1.41..7.56 rows=8 width=1,463) (actual time=0.029..0.209 rows=211 loops=1)

  • Hash Cond: (p.created_alias_id = groups_clients.client_alias_id)
10. 0.056 0.056 ↓ 1.0 243 1

Seq Scan on patients p (cost=0.00..5.43 rows=241 width=1,467) (actual time=0.009..0.056 rows=243 loops=1)

  • Filter: (NOT deleted)
  • Rows Removed by Filter: 2
11. 0.003 0.013 ↓ 4.0 4 1

Hash (cost=1.40..1.40 rows=1 width=4) (actual time=0.012..0.013 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
12. 0.010 0.010 ↓ 4.0 4 1

Seq Scan on groups_clients (cost=0.00..1.40 rows=1 width=4) (actual time=0.008..0.010 rows=4 loops=1)

  • Filter: (group_id = $109)
  • Rows Removed by Filter: 28
13. 0.211 0.211 ↑ 1.0 1 211

Index Scan using contacts_pkey on contacts con (cost=0.15..0.33 rows=1 width=473) (actual time=0.001..0.001 rows=1 loops=211)

  • Index Cond: (contact_id = p.contact_id)
14. 0.211 0.211 ↑ 1.0 1 211

Index Scan using contacts_info_pkey on contacts_info ci (cost=0.28..0.52 rows=1 width=43) (actual time=0.001..0.001 rows=1 loops=211)

  • Index Cond: (contact_info_id = con.contact_info_id)
15. 0.211 0.211 ↑ 1.0 1 211

Index Scan using addresses_pkey on addresses adrs (cost=0.27..0.44 rows=1 width=40) (actual time=0.001..0.001 rows=1 loops=211)

  • Index Cond: (con.address_id = address_id)
16. 0.000 1.477 ↓ 0.0 0 211

Subquery Scan on t (cost=0.00..13.30 rows=1 width=32) (actual time=0.007..0.007 rows=0 loops=211)

  • Filter: (t.row_num = 1)
17. 0.211 1.477 ↓ 0.0 0 211

WindowAgg (cost=0.00..13.29 rows=1 width=112) (actual time=0.007..0.007 rows=0 loops=211)

18. 0.140 1.266 ↓ 0.0 0 211

Nested Loop (cost=0.00..13.28 rows=1 width=104) (actual time=0.006..0.006 rows=0 loops=211)

  • Join Filter: (cr.contact_id = c.contact_id)
  • Rows Removed by Join Filter: 0
19. 0.422 0.422 ↓ 0.0 0 211

Seq Scan on contacts_relationships cr (cost=0.00..1.56 rows=1 width=72) (actual time=0.002..0.002 rows=0 loops=211)

  • Filter: ((patient_id = p.patient_id) AND (now() >= COALESCE(date_from, '1900-01-01 00:00:00'::timestamp without time zone)) AND (now() <= COALESCE(date_to, '2900-01-01 00:00:00'::timestamp without time zone)))
  • Rows Removed by Filter: 25
20. 0.704 0.704 ↑ 1.0 2 16

Seq Scan on contacts c (cost=0.00..11.69 rows=2 width=36) (actual time=0.019..0.044 rows=2 loops=16)

  • Filter: ((subtype)::text = 'MUTUALITY_BE'::text)
  • Rows Removed by Filter: 253
21. 0.000 0.633 ↑ 1.0 1 211

Aggregate (cost=1.35..1.36 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=211)

22. 0.633 0.633 ↓ 0.0 0 211

Seq Scan on patients_identity_documents pidt (cost=0.00..1.35 rows=1 width=548) (actual time=0.002..0.003 rows=0 loops=211)

  • Filter: (patient_id = p.patient_id)
  • Rows Removed by Filter: 38
23.          

SubPlan (for Nested Loop Left Join)

24. 1.477 1.477 ↑ 1.0 1 211

Result (cost=0.06..0.09 rows=1 width=32) (actual time=0.007..0.007 rows=1 loops=211)

25.          

Initplan (for Result)

26. 0.000 0.000 ↑ 1.0 1 211

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=211)

27. 0.000 0.000 ↑ 1.0 1 211

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=211)

28. 0.000 0.000 ↑ 1.0 1 211

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=211)

29. 0.000 0.000 ↑ 1.0 1 211

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=211)

30. 0.000 0.000 ↓ 0.0 0

Result (cost=0.00..0.01 rows=1 width=32) (never executed)

31. 0.000 0.000 ↓ 0.0 0

Result (cost=0.00..0.01 rows=1 width=32) (never executed)

32. 0.000 0.000 ↑ 1.0 1 211

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=211)

33. 0.000 0.000 ↑ 1.0 1 211

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=211)

Planning time : 1.404 ms
Execution time : 9.051 ms