explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qgft

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.312 674,175.805 ↓ 19.0 19 1

Limit (cost=45,702.52..45,702.53 rows=1 width=630) (actual time=674,175.243..674,175.805 rows=19 loops=1)

2. 0.500 674,175.493 ↓ 19.0 19 1

Sort (cost=45,702.52..45,702.53 rows=1 width=630) (actual time=674,175.224..674,175.493 rows=19 loops=1)

  • Sort Key: (lower((cliente1_.nome)::text)), cliente1_.id
  • Sort Method: quicksort Memory: 29kB
3. 0.478 674,174.993 ↓ 19.0 19 1

Group (cost=45,702.49..45,702.51 rows=1 width=630) (actual time=674,174.388..674,174.993 rows=19 loops=1)

  • Group Key: cliente1_.id, negativaca0_.data_negativacao, funcionari2_.nome, loja3_.nome
4. 0.419 674,174.515 ↓ 19.0 19 1

Sort (cost=45,702.49..45,702.50 rows=1 width=598) (actual time=674,174.361..674,174.515 rows=19 loops=1)

  • Sort Key: cliente1_.id, negativaca0_.data_negativacao, funcionari2_.nome, loja3_.nome
  • Sort Method: quicksort Memory: 27kB
5. 0.723 674,174.096 ↓ 19.0 19 1

Nested Loop (cost=38,200.61..45,702.48 rows=1 width=598) (actual time=276,107.010..674,174.096 rows=19 loops=1)

6. 1.603 674,171.568 ↓ 19.0 19 1

Nested Loop (cost=38,200.32..45,701.00 rows=1 width=565) (actual time=276,106.724..674,171.568 rows=19 loops=1)

  • Join Filter: (negativaca0_.loja_id = loja3_.id)
  • Rows Removed by Join Filter: 65
7. 17.211 674,168.996 ↓ 19.0 19 1

Nested Loop (cost=38,200.32..45,699.85 rows=1 width=57) (actual time=276,106.228..674,168.996 rows=19 loops=1)

  • Join Filter: (negativaca0_.funcionario_id = funcionari2_.id)
  • Rows Removed by Join Filter: 1,459
8. 318,090.276 674,132.804 ↓ 19.0 19 1

Nested Loop (cost=38,200.32..45,692.29 rows=1 width=40) (actual time=276,105.775..674,132.804 rows=19 loops=1)

  • Join Filter: (negativaca0_.cliente_id = prestacao4_.cliente_id)
  • Rows Removed by Join Filter: 29,759,597
9. 4,153.022 20,681.792 ↓ 11,772.0 11,772 1

Unique (cost=38,200.32..45,504.69 rows=1 width=8) (actual time=5,789.428..20,681.792 rows=11,772 loops=1)

10. 5,421.060 16,528.770 ↓ 359,478.0 359,478 1

Gather Merge (cost=38,200.32..45,504.69 rows=1 width=8) (actual time=5,789.409..16,528.770 rows=359,478 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
11. 3,408.437 11,107.710 ↓ 119,826.0 119,826 3 / 3

Merge Anti Join (cost=37,200.30..44,504.55 rows=1 width=8) (actual time=5,702.582..11,107.710 rows=119,826 loops=3)

  • Merge Cond: (prestacao4_.cliente_id = prestacao5_.cliente_id)
12. 4,494.809 7,179.279 ↑ 1.2 153,015 3 / 3

Sort (cost=28,329.67..28,799.42 rows=187,898 width=8) (actual time=5,315.136..7,179.279 rows=153,015 loops=3)

  • Sort Key: prestacao4_.cliente_id
  • Sort Method: external merge Disk: 2,848kB
  • Worker 0: Sort Method: external merge Disk: 2,696kB
  • Worker 1: Sort Method: external merge Disk: 2,584kB
13. 2,684.470 2,684.470 ↑ 1.2 153,015 3 / 3

Parallel Seq Scan on prestacao prestacao4_ (cost=0.00..9,301.19 rows=187,898 width=8) (actual time=0.138..2,684.470 rows=153,015 loops=3)

  • Filter: ((recebimento_id IS NOT NULL) AND (data_vencimento < '2020-07-07'::date))
  • Rows Removed by Filter: 7,510
14. 312.892 519.994 ↑ 1.7 12,086 3 / 3

Sort (cost=8,870.62..8,920.79 rows=20,065 width=8) (actual time=387.413..519.994 rows=12,086 loops=3)

  • Sort Key: prestacao5_.cliente_id
  • Sort Method: quicksort Memory: 951kB
  • Worker 0: Sort Method: quicksort Memory: 951kB
  • Worker 1: Sort Method: quicksort Memory: 951kB
15. 203.693 207.102 ↑ 1.7 12,088 3 / 3

Bitmap Heap Scan on prestacao prestacao5_ (cost=387.30..7,436.74 rows=20,065 width=8) (actual time=4.021..207.102 rows=12,088 loops=3)

  • Recheck Cond: (recebimento_id IS NULL)
  • Filter: (data_vencimento < '2020-07-07'::date)
  • Rows Removed by Filter: 8,802
  • Heap Blocks: exact=2,745
16. 3.409 3.409 ↓ 1.0 20,890 3 / 3

Bitmap Index Scan on prestacao_recebimento_id_ix (cost=0.00..382.28 rows=20,515 width=0) (actual time=3.402..3.409 rows=20,890 loops=3)

  • Index Cond: (recebimento_id IS NULL)
17. 335,360.736 335,360.736 ↑ 1.0 2,528 11,772

Seq Scan on negativacao_cliente negativaca0_ (cost=0.00..155.99 rows=2,528 width=32) (actual time=0.019..28.488 rows=2,528 loops=11,772)

  • Filter: (data_remocao_negativacao IS NULL)
  • Rows Removed by Filter: 4,371
18. 18.981 18.981 ↑ 2.0 78 19

Seq Scan on funcionario funcionari2_ (cost=0.00..5.58 rows=158 width=33) (actual time=0.018..0.999 rows=78 loops=19)

19. 0.969 0.969 ↑ 1.8 4 19

Seq Scan on loja loja3_ (cost=0.00..1.07 rows=7 width=524) (actual time=0.017..0.051 rows=4 loops=19)

20. 1.805 1.805 ↑ 1.0 1 19

Index Scan using cliente_pkey on cliente cliente1_ (cost=0.29..1.48 rows=1 width=49) (actual time=0.095..0.095 rows=1 loops=19)

  • Index Cond: (id = negativaca0_.cliente_id)
Planning time : 2.464 ms
Execution time : 674,178.378 ms