explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bdpa

Settings
# exclusive inclusive rows x rows loops node
1. 0.041 5,147.667 ↓ 0.0 0 1

Sort (cost=140,932.79..140,936.97 rows=1,672 width=95) (actual time=5,147.651..5,147.667 rows=0 loops=1)

  • Sort Key: listtipoun2_.id
  • Sort Method: quicksort Memory: 25kB
2. 0.001 5,147.626 ↓ 0.0 0 1

Nested Loop (cost=62,566.86..140,843.27 rows=1,672 width=95) (actual time=5,147.610..5,147.626 rows=0 loops=1)

3. 0.003 5,147.625 ↓ 0.0 0 1

Nested Loop (cost=62,566.44..140,065.24 rows=1,668 width=119) (actual time=5,147.609..5,147.625 rows=0 loops=1)

4. 0.108 0.108 ↑ 1.0 1 1

Index Only Scan using empresa_pk on empresa empresa4_ (cost=0.27..4.29 rows=1 width=12) (actual time=0.099..0.108 rows=1 loops=1)

  • Index Cond: (id = ''T1EUKUVKVFWY''::text)
  • Heap Fetches: 0
5. 134.361 5,147.514 ↓ 0.0 0 1

Hash Join (cost=62,566.16..140,044.27 rows=1,668 width=130) (actual time=5,147.499..5,147.514 rows=0 loops=1)

  • Hash Cond: ((obraservic0_.id_obra)::text = (obra3_.id)::text)
  • Join Filter: ((listtipoun2_.dat_alteracao > ''2020-09-02 10:49:32.379-03''::timestamp with time zone) OR (alternatives: SubPlan 3 or hashed SubPlan 4) OR (obra3_.dat_alteracao > ''2020-09-02 10:49:32.379-03''::timestamp with time zone))
6. 1,281.892 4,696.114 ↑ 1.0 833,406 1

Hash Join (cost=61,431.18..134,881.18 rows=837,305 width=133) (actual time=2,506.631..4,696.114 rows=833,406 loops=1)

  • Hash Cond: ((listtipoun2_.id_servico)::text = (obraservic0_.id_servico)::text)
7. 931.161 931.161 ↑ 1.0 833,406 1

Seq Scan on servico_tipo_unidade listtipoun2_ (cost=0.00..28,846.05 rows=837,305 width=102) (actual time=14.493..931.161 rows=833,406 loops=1)

8. 588.712 2,483.061 ↑ 1.0 1,009,680 1

Hash (cost=41,844.97..41,844.97 rows=1,012,897 width=31) (actual time=2,483.060..2,483.061 rows=1,009,680 loops=1)

  • Buckets: 1,048,576 Batches: 2 Memory Usage: 39,557kB
9. 1,894.349 1,894.349 ↑ 1.0 1,009,680 1

Seq Scan on obra_servico obraservic0_ (cost=0.00..41,844.97 rows=1,012,897 width=31) (actual time=7.885..1,894.349 rows=1,009,680 loops=1)

10. 0.019 317.039 ↑ 23.0 1 1

Hash (cost=1,134.69..1,134.69 rows=23 width=33) (actual time=317.033..317.039 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
11. 169.426 317.020 ↑ 23.0 1 1

Bitmap Heap Scan on obra obra3_ (cost=4.60..1,134.69 rows=23 width=33) (actual time=312.503..317.020 rows=1 loops=1)

  • Recheck Cond: ((id_empresa)::text = ''T1EUKUVKVFWY''::text)
  • Filter: ((alternatives: SubPlan 1 or hashed SubPlan 2) OR (flg_lib_todos_disp AND (dat_inativacao IS NULL)))
  • Rows Removed by Filter: 40
  • Heap Blocks: exact=31
12. 14.563 14.563 ↑ 1.0 41 1

Bitmap Index Scan on obra_id_empresa_idx (cost=0.00..4.59 rows=41 width=0) (actual time=14.562..14.563 rows=41 loops=1)

  • Index Cond: ((id_empresa)::text = ''T1EUKUVKVFWY''::text)
13.          

SubPlan (for Bitmap Heap Scan)

14. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.97..25.05 rows=1 width=0) (never executed)

15. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.69..16.75 rows=1 width=20) (never executed)

16. 0.000 0.000 ↓ 0.0 0

Index Only Scan using obra_dispositivo_uk on obra_dispositivo obradispos5_ (cost=0.41..8.43 rows=1 width=34) (never executed)

  • Index Cond: ((dat_inativacao IS NULL) AND (id_obra = (obra3_.id)::text) AND (id_dispositivo = ''AND_713CEA370B7B5B7E''::text))
  • Heap Fetches: 0
17. 0.000 0.000 ↓ 0.0 0

Index Only Scan using obra_pk on obra obra6_ (cost=0.28..8.30 rows=1 width=14) (never executed)

  • Index Cond: (id = (obra3_.id)::text)
  • Heap Fetches: 0
18. 0.000 0.000 ↓ 0.0 0

Index Scan using dispositivo_pk on dispositivo dispositiv7_ (cost=0.28..8.30 rows=1 width=20) (never executed)

  • Index Cond: ((id)::text = ''AND_713CEA370B7B5B7E''::text)
  • Filter: (dat_inativacao IS NULL)
19. 0.017 133.031 ↑ 3.0 1 1

Nested Loop (cost=4.88..48.44 rows=3 width=32) (actual time=133.020..133.031 rows=1 loops=1)

20. 50.055 50.055 ↑ 1.0 1 1

Index Scan using dispositivo_pk on dispositivo dispositiv7__1 (cost=0.28..8.30 rows=1 width=20) (actual time=50.050..50.055 rows=1 loops=1)

  • Index Cond: ((id)::text = ''AND_713CEA370B7B5B7E''::text)
  • Filter: (dat_inativacao IS NULL)
21. 0.015 82.959 ↑ 3.0 1 1

Nested Loop (cost=4.60..40.11 rows=3 width=34) (actual time=82.954..82.959 rows=1 loops=1)

22. 35.574 41.283 ↑ 3.0 1 1

Bitmap Heap Scan on obra_dispositivo obradispos5__1 (cost=4.32..19.21 rows=3 width=34) (actual time=41.279..41.283 rows=1 loops=1)

  • Recheck Cond: ((id_dispositivo)::text = ''AND_713CEA370B7B5B7E''::text)
  • Filter: (dat_inativacao IS NULL)
  • Heap Blocks: exact=1
23. 5.709 5.709 ↑ 4.0 1 1

Bitmap Index Scan on obra_dispositivo_dispositivo_idx (cost=0.00..4.32 rows=4 width=0) (actual time=5.709..5.709 rows=1 loops=1)

  • Index Cond: ((id_dispositivo)::text = ''AND_713CEA370B7B5B7E''::text)
24. 41.661 41.661 ↑ 1.0 1 1

Index Only Scan using obra_pk on obra obra6__1 (cost=0.28..6.97 rows=1 width=14) (actual time=41.661..41.661 rows=1 loops=1)

  • Index Cond: (id = (obradispos5__1.id_obra)::text)
  • Heap Fetches: 1
25.          

SubPlan (for Hash Join)

26. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.97..25.06 rows=1 width=0) (never executed)

27. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.69..16.75 rows=1 width=20) (never executed)

28. 0.000 0.000 ↓ 0.0 0

Index Scan using obra_dispositivo_uk on obra_dispositivo obradispos8_ (cost=0.41..8.44 rows=1 width=34) (never executed)

  • Index Cond: ((dat_inativacao IS NULL) AND ((id_obra)::text = (obra3_.id)::text) AND ((id_dispositivo)::text = ''AND_713CEA370B7B5B7E''::text))
  • Filter: (dat_alteracao > ''2020-09-02 10:49:32.379-03''::timestamp with time zone)
29. 0.000 0.000 ↓ 0.0 0

Index Only Scan using obra_pk on obra obra9_ (cost=0.28..8.30 rows=1 width=14) (never executed)

  • Index Cond: (id = (obra3_.id)::text)
  • Heap Fetches: 0
30. 0.000 0.000 ↓ 0.0 0

Index Scan using dispositivo_pk on dispositivo dispositiv10_ (cost=0.28..8.30 rows=1 width=20) (never executed)

  • Index Cond: ((id)::text = ''AND_713CEA370B7B5B7E''::text)
  • Filter: (dat_inativacao IS NULL)
31. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=9.51..29.57 rows=1 width=32) (never executed)

32. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=9.23..21.26 rows=1 width=34) (never executed)

33. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on obra_dispositivo obradispos8__1 (cost=8.95..12.96 rows=1 width=34) (never executed)

  • Recheck Cond: (((id_dispositivo)::text = ''AND_713CEA370B7B5B7E''::text) AND (dat_alteracao > ''2020-09-02 10:49:32.379-03''::timestamp with time zone))
  • Filter: (dat_inativacao IS NULL)
34. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=8.95..8.95 rows=1 width=0) (never executed)

35. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on obra_dispositivo_dispositivo_idx (cost=0.00..4.32 rows=4 width=0) (never executed)

  • Index Cond: ((id_dispositivo)::text = ''AND_713CEA370B7B5B7E''::text)
36. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on obra_dispositivo_dat_alteracao_idx (cost=0.00..4.38 rows=12 width=0) (never executed)

  • Index Cond: (dat_alteracao > ''2020-09-02 10:49:32.379-03''::timestamp with time zone)
37. 0.000 0.000 ↓ 0.0 0

Index Only Scan using obra_pk on obra obra9__1 (cost=0.28..8.30 rows=1 width=14) (never executed)

  • Index Cond: (id = (obradispos8__1.id_obra)::text)
  • Heap Fetches: 0
38. 0.000 0.000 ↓ 0.0 0

Index Scan using dispositivo_pk on dispositivo dispositiv10__1 (cost=0.28..8.30 rows=1 width=20) (never executed)

  • Index Cond: ((id)::text = ''AND_713CEA370B7B5B7E''::text)
  • Filter: (dat_inativacao IS NULL)
39. 0.000 0.000 ↓ 0.0 0

Index Only Scan using servico_pk on servico servico1_ (cost=0.42..0.47 rows=1 width=17) (never executed)

  • Index Cond: (id = (obraservic0_.id_servico)::text)
  • Heap Fetches: 0
Planning time : 1,385.461 ms