explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gCRu8

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 7,897.344 ↓ 2.0 10 1

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

2. 0.052 7,897.342 ↓ 2.0 10 1

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

  • Sort Key: customers.lastname
  • Sort Method: quicksort Memory: 26kB
3. 0.000 7,897.290 ↓ 4.0 20 1

Nested Loop (cost=1.14..47,221.04 rows=5 width=23) (actual time=946.627..7,897.290 rows=20 loops=1)

4. 190.520 1,825.989 ↓ 26.3 2,084,902 1

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

5. 3.841 7.090 ↓ 12.8 153 1

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

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

Nested Loop (cost=0.00..604.51 rows=566 width=16) (actual time=1.075..3.249 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.304 1.425 ↑ 1.0 1 1

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

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

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

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

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

10. 0.967 0.967 ↑ 1.0 5,095 1

Seq Scan on orgunits (cost=0.00..184.95 rows=5,095 width=24) (actual time=0.001..0.967 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.006 0.006 ↑ 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.006 rows=5 loops=1)

  • Index Cond: (salesforceid = 313)
13. 1,628.379 1,628.379 ↓ 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.643 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 ~~ 'NIGAM%'::text) AND (customertypeid = 1))
  • Rows Removed by Filter: 1
Planning time : 1.268 ms