explain.depesz.com

PostgreSQL's explain analyze made readable

Result: zp9x

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 7,807.801 ↓ 2.0 10 1

Limit (cost=47,221.10..47,221.11 rows=5 width=23) (actual time=7,807.800..7,807.801 rows=10 loops=1)

2. 0.485 7,807.800 ↓ 2.0 10 1

Sort (cost=47,221.10..47,221.11 rows=5 width=23) (actual time=7,807.799..7,807.800 rows=10 loops=1)

  • Sort Key: customers.lastname
  • Sort Method: top-N heapsort Memory: 25kB
3. 0.000 7,807.315 ↓ 35.0 175 1

Nested Loop (cost=1.14..47,221.04 rows=5 width=23) (actual time=30.630..7,807.315 rows=175 loops=1)

4. 190.633 1,794.424 ↓ 26.3 2,084,902 1

Nested Loop (cost=0.71..9,216.20 rows=79,181 width=16) (actual time=3.211..1,794.424 rows=2,084,902 loops=1)

5. 3.799 7.083 ↓ 12.8 153 1

Nested Loop (cost=0.14..655.21 rows=12 width=8) (actual time=3.198..7.083 rows=153 loops=1)

  • Join Filter: (orgunits.orgunitlevelid = ol.orgunitlevelid)
  • Rows Removed by Join Filter: 24912
6. 0.852 3.284 ↓ 8.9 5,013 1

Nested Loop (cost=0.00..604.51 rows=566 width=16) (actual time=1.102..3.284 rows=5,013 loops=1)

  • Join Filter: ((orgunits.treeleft >= orgunits_1.treeleft) AND (orgunits.treeright <= orgunits_1.treeright))
  • Rows Removed by Join Filter: 82
7. 0.307 1.449 ↑ 1.0 1 1

Nested Loop (cost=0.00..343.14 rows=1 width=8) (actual time=1.096..1.449 rows=1 loops=1)

  • Join Filter: (orgunits_1.orgunitid = uom.orgunitid)
  • Rows Removed by Join Filter: 5094
8. 0.346 0.346 ↑ 1.0 1 1

Seq Scan on userorgunitmapping uom (cost=0.00..94.50 rows=1 width=8) (actual time=0.009..0.346 rows=1 loops=1)

  • Filter: (userid = 5910)
  • Rows Removed by Filter: 4999
9. 0.796 0.796 ↑ 1.0 5,095 1

Seq Scan on orgunits orgunits_1 (cost=0.00..184.95 rows=5,095 width=16) (actual time=0.002..0.796 rows=5,095 loops=1)

10. 0.983 0.983 ↑ 1.0 5,095 1

Seq Scan on orgunits (cost=0.00..184.95 rows=5,095 width=24) (actual time=0.002..0.983 rows=5,095 loops=1)

11. 0.000 0.000 ↑ 1.0 5 5,013

Materialize (cost=0.14..8.26 rows=5 width=8) (actual time=0.000..0.000 rows=5 loops=5,013)

12. 0.008 0.008 ↑ 1.0 5 1

Index Scan using orgunitlevel_salesforceid_idx on orgunitlevel ol (cost=0.14..8.23 rows=5 width=8) (actual time=0.005..0.008 rows=5 loops=1)

  • Index Cond: (salesforceid = 313)
13. 1,596.708 1,596.708 ↓ 1.0 13,627 153

Index Scan using alignments_orgunitid_idx on alignments (cost=0.56..580.22 rows=13,320 width=24) (actual time=0.007..10.436 rows=13,627 loops=153)

  • Index Cond: (orgunitid = orgunits.orgunitid)
14. 6,254.706 6,254.706 ↓ 0.0 0 2,084,902

Index Scan using pk_customers_customerid on customers (cost=0.43..0.47 rows=1 width=15) (actual time=0.003..0.003 rows=0 loops=2,084,902)

  • Index Cond: (customerid = alignments.customerid)
  • Filter: ((lastname ~~ 'NIG%'::text) AND (customertypeid = 1))
  • Rows Removed by Filter: 1
Planning time : 1.422 ms