explain.depesz.com

PostgreSQL's explain analyze made readable

Result: l1FQ : Optimization for: plan #iwjj

Settings

Optimization path:

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

Sort (cost=72,106.88..72,107.38 rows=200 width=397) (actual rows= loops=)

  • Sort Key: "filteredPayments".date DESC
2.          

CTE filteredPayments

3. 0.000 0.000 ↓ 0.0

Limit (cost=60,768.22..66,744.82 rows=100 width=107) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Gather Merge (cost=1,002.17..556,467.82 rows=9,294 width=107) (actual rows= loops=)

  • Workers Planned: 2
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.15..554,395.03 rows=3,872 width=107) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.71..428,222.48 rows=17,426 width=96) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.14..298,624.50 rows=17,426 width=63) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Parallel Index Scan using "payments_accountId_date" on payments (cost=0.57..203,781.24 rows=21,292 width=59) (actual rows= loops=)

  • Index Cond: ("accountId" = 6,139,068)
9. 0.000 0.000 ↓ 0.0

Index Only Scan using "paymentToReservation_uniq_constraint" on "paymentToReservation" ptor (cost=0.57..4.44 rows=1 width=8) (actual rows= loops=)

  • Index Cond: ("paymentId" = payments.id)
10. 0.000 0.000 ↓ 0.0

Index Scan using reservations_pkey on reservations (cost=0.57..7.44 rows=1 width=37) (actual rows= loops=)

  • Index Cond: (id = ptor."reservationId")
11. 0.000 0.000 ↓ 0.0

Index Scan using vehicles_pkey on vehicles (cost=0.43..7.24 rows=1 width=19) (actual rows= loops=)

  • Index Cond: (id = reservations."vehicleId")
  • Filter: (vrp ~~ '%A%'::text)
12. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,071.82..5,354.42 rows=200 width=397) (actual rows= loops=)

  • Join Filter: (("accountTransfers"."writeoffPaymentId" = "filteredPayments".id) OR ("accountTransfers"."refillPaymentId" = "filteredPayments".id))
13. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,071.82..4,054.29 rows=100 width=1,644) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1,071.25..3,195.29 rows=100 width=341) (actual rows= loops=)

  • Hash Cond: ("filteredPayments".id = ptob.id)
15. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.29..2,125.06 rows=100 width=309) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.86..1,296.75 rows=100 width=289) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.43..847.00 rows=100 width=285) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

CTE Scan on "filteredPayments" (cost=0.00..2.00 rows=100 width=273) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Index Scan using "paymentSources_pkey" on "paymentSources" (cost=0.43..8.45 rows=1 width=16) (actual rows= loops=)

  • Index Cond: ("filteredPayments"."sourceId" = id)
20. 0.000 0.000 ↓ 0.0

Index Only Scan using "paymentToGatedParkingSession_uniq_constraint" on "paymentToGatedParkingSession" (cost=0.43..4.49 rows=1 width=8) (actual rows= loops=)

  • Index Cond: ("paymentId" = "filteredPayments".id)
21. 0.000 0.000 ↓ 0.0

Index Scan using "gatedParkingSessions_pkey" on "gatedParkingSessions" (cost=0.43..8.28 rows=1 width=24) (actual rows= loops=)

  • Index Cond: ("paymentToGatedParkingSession"."gatedParkingSessionId" = id)
22. 0.000 0.000 ↓ 0.0

Hash (cost=1,068.71..1,068.71 rows=100 width=36) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Subquery Scan on ptob (cost=1,066.46..1,068.71 rows=100 width=36) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

HashAggregate (cost=1,066.46..1,067.71 rows=100 width=36) (actual rows= loops=)

  • Group Key: "filteredPayments_1".id
25. 0.000 0.000 ↓ 0.0

Hash Join (cost=7.43..1,063.40 rows=408 width=78) (actual rows= loops=)

  • Hash Cond: (grants."benefitId" = benefits.id)
26. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.00..1,055.85 rows=408 width=12) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.57..872.02 rows=408 width=12) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

CTE Scan on "filteredPayments" "filteredPayments_1" (cost=0.00..2.00 rows=100 width=8) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Index Scan using "reservationIntervals_reservationId" on "reservationIntervals" (cost=0.57..8.66 rows=4 width=12) (actual rows= loops=)

  • Index Cond: ("reservationId" = "filteredPayments_1"."reservationId")
30. 0.000 0.000 ↓ 0.0

Index Scan using grants_pkey on grants (cost=0.43..0.45 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = "reservationIntervals"."grantId")
31. 0.000 0.000 ↓ 0.0

Hash (cost=5.08..5.08 rows=108 width=74) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Seq Scan on benefits (cost=0.00..5.08 rows=108 width=74) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Index Scan using "transactionExtraFields_transactionId_idx" on "transactionExtraFields" (cost=0.57..8.59 rows=1 width=1,307) (actual rows= loops=)

  • Index Cond: ("transactionId" = "filteredPayments"."transactionId")
34. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..19.95 rows=730 width=110) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Seq Scan on "accountTransfers" (cost=0.00..16.30 rows=730 width=110) (actual rows= loops=)