explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZDn1

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 490.049 ↑ 1.1 87 1

Limit (cost=8,468.58..8,468.83 rows=100 width=25) (actual time=490.038..490.049 rows=87 loops=1)

2. 0.403 490.041 ↑ 287.6 87 1

Sort (cost=8,468.58..8,531.14 rows=25,022 width=25) (actual time=490.037..490.041 rows=87 loops=1)

  • Sort Key: "Banks"."Name", "Customers"."FullName
  • Sort Method: quicksort Memory: 31kB
3. 0.078 489.638 ↑ 287.6 87 1

Nested Loop (cost=3,157.16..7,512.26 rows=25,022 width=25) (actual time=84.279..489.638 rows=87 loops=1)

4. 0.134 0.134 ↑ 1.0 1 1

Seq Scan on "Banks" (cost=0.00..2.01 rows=1 width=14) (actual time=0.132..0.134 rows=1 loops=1)

  • Filter: ("BankId" = 1)
5. 390.297 489.426 ↑ 287.6 87 1

Hash Right Join (cost=3,157.16..7,260.03 rows=25,022 width=19) (actual time=84.143..489.426 rows=87 loops=1)

  • Hash Cond: ("CustomerAddresses"."CustomerId" = "Customers"."CustomerId")
  • Filter: ((lower(("Customers"."CustomerNumber")::text) ~~ '%michael%'::text) OR (("Customers"."TaxId")::text ~~ '%michael%'::text) OR (lower(("Customers"."FullName")::text) ~~ '%michael%'::text) OR (lower(("CustomerAddresses"."EmailAddress1")::text) ~~ '%michael%'::text) OR (lower(("CustomerAddresses"."EmailAddress2")::text) ~~ '%michael%'::text) OR (lower(("CustomerAddresses"."HomePhone")::text) ~~ '%michael%'::text) OR (lower(("CustomerAddresses"."WorkPhone")::text) ~~ '%michael%'::text) OR (lower(("CustomerAddresses"."MobilePhone")::text) ~~ '%michael%'::text) OR (alternatives: SubPlan 1 or hashed SubPlan 2))
  • Rows Removed by Filter: 49917
6. 19.498 19.498 ↓ 1.0 50,004 1

Seq Scan on "CustomerAddresses" (cost=0.00..3,967.06 rows=50,003 width=104) (actual time=0.024..19.498 rows=50,004 loops=1)

  • Filter: ("AddressIndex" = 0)
  • Rows Removed by Filter: 1
7. 17.230 44.250 ↑ 1.0 50,004 1

Hash (cost=2,532.11..2,532.11 rows=50,004 width=37) (actual time=44.250..44.250 rows=50,004 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 4060kB
8. 27.020 27.020 ↑ 1.0 50,004 1

Index Only Scan using idx_customers_covering2 on "Customers" (cost=0.41..2,532.11 rows=50,004 width=37) (actual time=0.033..27.020 rows=50,004 loops=1)

  • Index Cond: ("BankId" = 1)
  • Heap Fetches: 5
9.          

SubPlan (forHash Right Join)

10. 0.000 0.000 ↓ 0.0 0

Index Only Scan using idx_customerrelationships_covering2 on "CustomerRelationships" (cost=0.42..4.50 rows=1 width=0) (never executed)

  • Index Cond: ("CustomerId" = "Customers"."CustomerId")
  • Filter: (("AccountNumber")::text ~~ '%michael%'::text)
  • Heap Fetches: 0
11. 35.381 35.381 ↓ 0.0 0 1

Index Only Scan using idx_customerrelationships_covering2 on "CustomerRelationships" "CustomerRelationships_1" (cost=0.42..6,345.42 rows=17 width=4) (actual time=35.381..35.381 rows=0 loops=1)

  • Filter: (("AccountNumber")::text ~~ '%michael%'::text)
  • Rows Removed by Filter: 171714
  • Heap Fetches: 0