explain.depesz.com

PostgreSQL's explain analyze made readable

Result: q1Jh

Settings
# exclusive inclusive rows x rows loops node
1. 2,534.205 13,215.418 ↑ 1.0 976,784 1

Sort (cost=1,830,229.63..1,832,671.59 rows=976,784 width=773) (actual time=12,759.585..13,215.418 rows=976,784 loops=1)

  • Sort Key: main_calculation.created_at DESC
  • Sort Method: external merge Disk: 507232kB
2. 1,330.693 10,681.213 ↑ 1.0 976,784 1

GroupAggregate (cost=729,287.43..1,065,320.96 rows=976,784 width=773) (actual time=4,702.078..10,681.213 rows=976,784 loops=1)

  • Group Key: main_calculation.id
3. 1,343.247 9,350.520 ↓ 1.0 3,604,870 1

Merge Left Join (cost=729,287.43..1,028,969.13 rows=3,544,532 width=765) (actual time=4,702.054..9,350.520 rows=3,604,870 loops=1)

  • Merge Cond: (main_calculation.id = main_result.calculation_id)
4. 1,753.753 1,753.753 ↑ 1.0 976,784 1

Index Scan using "idx_457863_PRIMARY" on main_calculation (cost=0.42..235,210.85 rows=976,784 width=757) (actual time=0.063..1,753.753 rows=976,784 loops=1)

5. 439.014 6,253.520 ↓ 1.0 3,554,425 1

Materialize (cost=729,287.00..747,009.66 rows=3,544,532 width=16) (actual time=4,701.974..6,253.520 rows=3,554,425 loops=1)

6. 3,149.459 5,814.506 ↓ 1.0 3,554,425 1

Sort (cost=729,287.00..738,148.33 rows=3,544,532 width=16) (actual time=4,701.966..5,814.506 rows=3,554,425 loops=1)

  • Sort Key: main_result.calculation_id
  • Sort Method: external merge Disk: 65496kB
7. 948.085 2,665.047 ↓ 1.0 3,554,425 1

Hash Right Join (cost=174,595.97..222,536.19 rows=3,544,532 width=16) (actual time=1,515.347..2,665.047 rows=3,554,425 loops=1)

  • Hash Cond: (policy_agreement.result_id = main_result.id)
8. 203.274 203.274 ↑ 1.0 378,117 1

Seq Scan on policy_agreement (cost=0.00..20,321.17 rows=378,117 width=16) (actual time=0.005..203.274 rows=378,117 loops=1)

9. 640.495 1,513.688 ↓ 1.0 3,547,513 1

Hash (cost=112,981.32..112,981.32 rows=3,544,532 width=16) (actual time=1,513.688..1,513.688 rows=3,547,513 loops=1)

  • Buckets: 131072 Batches: 64 Memory Usage: 3616kB
10. 873.193 873.193 ↓ 1.0 3,547,513 1

Seq Scan on main_result (cost=0.00..112,981.32 rows=3,544,532 width=16) (actual time=0.341..873.193 rows=3,547,513 loops=1)

Planning time : 14.753 ms
Execution time : 16,994.165 ms