explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CSjV

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 58,028.784 ↑ 1.0 500 1

Limit (cost=4,065,957.96..4,065,959.21 rows=500 width=50) (actual time=58,028.699..58,028.784 rows=500 loops=1)

2.          

Initplan (forLimit)

3. 0.021 0.021 ↑ 1.0 1 1

Result (cost=0.00..0.02 rows=1 width=0) (actual time=0.020..0.021 rows=1 loops=1)

4. 0.027 0.027 ↑ 1.0 1 1

Result (cost=0.00..0.03 rows=1 width=0) (actual time=0.027..0.027 rows=1 loops=1)

5. 0.317 58,028.746 ↑ 727.7 500 1

Sort (cost=4,065,957.91..4,066,867.55 rows=363,855 width=50) (actual time=58,028.697..58,028.746 rows=500 loops=1)

  • Sort Key: (COALESCE(sum(posbreakdown.count), 0::bigint))
  • Sort Method: quicksort Memory: 130kB
6. 1,937.361 58,028.429 ↑ 455.4 799 1

GroupAggregate (cost=4,024,176.83..4,047,827.41 rows=363,855 width=50) (actual time=55,636.686..58,028.429 rows=799 loops=1)

  • Group Key: company.accountcode
7. 2,076.903 56,091.068 ↓ 3.7 1,340,507 1

Sort (cost=4,024,176.83..4,025,086.47 rows=363,855 width=50) (actual time=55,636.637..56,091.068 rows=1,340,507 loops=1)

  • Sort Key: company.accountcode
  • Sort Method: external merge Disk: 60304kB
8. 859.343 54,014.165 ↓ 3.7 1,340,507 1

Hash Join (cost=138,164.20..3,978,130.36 rows=363,855 width=50) (actual time=42,501.724..54,014.165 rows=1,340,507 loops=1)

  • Hash Cond: (merchant.parentid = company.accountid)
9. 520.260 52,909.081 ↓ 3.7 1,340,507 1

Hash Join (cost=67,753.10..3,887,921.34 rows=363,855 width=32) (actual time=42,250.488..52,909.081 rows=1,340,507 loops=1)

  • Hash Cond: (posbreakdown.merchantid = merchant.accountid)
10. 52,148.905 52,148.905 ↓ 3.7 1,340,507 1

Seq Scan on posaggregationdaily posbreakdown (cost=0.00..3,804,847.60 rows=363,855 width=32) (actual time=42,010.094..52,148.905 rows=1,340,507 loops=1)

  • Filter: ((date >= $0) AND (date < $1) AND ((CASE WHEN (result = 0) THEN 'Unknown'::text WHEN (result = 1) THEN 'Approved'::text WHEN (result = 2) THEN 'Refused'::text WHEN (result = 4) THEN 'Error'::text ELSE NULL::text END <> 'Unknown'::text) OR (CASE WHEN (result = 0) THEN 'Unknown'::text WHEN (result = 1) THEN 'Approved'::text WHEN (result = 2) THEN 'Refused'::text WHEN (result = 4) THEN 'Error'::text ELSE NULL::text END IS NULL)))
  • Rows Removed by Filter: 71762394
11. 119.522 239.916 ↑ 1.3 703,471 1

Hash (cost=51,977.71..51,977.71 rows=907,471 width=16) (actual time=239.916..239.916 rows=703,471 loops=1)

  • Buckets: 8192 Batches: 32 Memory Usage: 1044kB
12. 120.394 120.394 ↑ 1.3 703,471 1

Seq Scan on account merchant (cost=0.00..51,977.71 rows=907,471 width=16) (actual time=0.007..120.394 rows=703,471 loops=1)

13. 131.459 245.741 ↑ 1.3 703,471 1

Hash (cost=51,977.71..51,977.71 rows=907,471 width=34) (actual time=245.741..245.741 rows=703,471 loops=1)

  • Buckets: 4096 Batches: 32 Memory Usage: 1524kB
14. 114.282 114.282 ↑ 1.3 703,471 1

Seq Scan on account company (cost=0.00..51,977.71 rows=907,471 width=34) (actual time=0.007..114.282 rows=703,471 loops=1)