explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tVQ : Optimization for: plan #tM1N

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.318 619.546 ↑ 1.0 100 1

Limit (cost=45,518.71..45,525.46 rows=100 width=112) (actual time=617.570..619.546 rows=100 loops=1)

2.          

CTE one

3. 60.346 101.604 ↑ 1.0 14,473 1

Hash Join (cost=1.58..1,100.81 rows=14,576 width=46) (actual time=0.286..101.604 rows=14,473 loops=1)

  • Hash Cond: (doc_management_request_az.zags_list_azkind_id = zags_list_azkind.zags_list_azkind_id)
4. 41.166 41.166 ↑ 1.0 14,473 1

Index Scan using doc_management_request_request_id on doc_management_request_az (cost=0.42..934.11 rows=14,576 width=24) (actual time=0.143..41.166 rows=14,473 loops=1)

  • Index Cond: (doc_management_request_id = 550)
  • Filter: (az_is_found AND (zags_az_id IS NOT NULL))
5. 0.052 0.092 ↑ 1.0 7 1

Hash (cost=1.07..1.07 rows=7 width=38) (actual time=0.092..0.092 rows=7 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
6. 0.040 0.040 ↑ 1.0 7 1

Seq Scan on zags_list_azkind (cost=0.00..1.07 rows=7 width=38) (actual time=0.016..0.040 rows=7 loops=1)

7.          

CTE two

8. 40.378 618.160 ↑ 43.6 334 1

Sort (cost=44,381.44..44,417.88 rows=14,576 width=212) (actual time=617.461..618.160 rows=334 loops=1)

  • Sort Key: zags_az.az_date DESC
  • Sort Method: quicksort Memory: 4143kB
9. 66.794 577.782 ↑ 1.0 14,473 1

Hash Join (cost=42,881.47..43,373.41 rows=14,576 width=212) (actual time=348.002..577.782 rows=14,473 loops=1)

  • Hash Cond: (one.zags_az_id = zags_az.zags_az_id)
10. 163.521 163.521 ↑ 1.0 14,473 1

CTE Scan on one (cost=0.00..291.52 rows=14,576 width=48) (actual time=0.295..163.521 rows=14,473 loops=1)

11. 63.100 347.467 ↓ 1.0 17,254 1

Hash (cost=42,667.36..42,667.36 rows=17,129 width=176) (actual time=347.467..347.467 rows=17,254 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 3598kB
12. 68.129 284.367 ↓ 1.0 17,254 1

Gather (cost=1,000.42..42,667.36 rows=17,129 width=176) (actual time=1.117..284.367 rows=17,254 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
13. 149.708 216.238 ↑ 1.2 8,627 2

Nested Loop (cost=0.42..39,954.46 rows=10,076 width=176) (actual time=0.151..216.238 rows=8,627 loops=2)

14. 66.522 66.522 ↑ 1.2 8,627 2

Parallel Seq Scan on zags_az (cost=0.00..2,894.76 rows=10,076 width=28) (actual time=0.056..66.522 rows=8,627 loops=2)

15. 0.008 0.008 ↑ 1.0 1 17,254

Index Scan using government_list_body_pkey on government_list_body (cost=0.42..3.68 rows=1 width=164) (actual time=0.008..0.008 rows=1 loops=17,254)

  • Index Cond: (government_list_body_id = zags_az.az_first_gov_list_body_id)
16.          

Initplan (forLimit)

17. 0.006 0.010 ↑ 1.0 1 1

Limit (cost=0.00..0.02 rows=1 width=8) (actual time=0.008..0.010 rows=1 loops=1)

18. 0.004 0.004 ↑ 14,576.0 1 1

CTE Scan on two two_1 (cost=0.00..291.52 rows=14,576 width=8) (actual time=0.004..0.004 rows=1 loops=1)

19. 619.218 619.218 ↑ 48.6 100 1

CTE Scan on two (cost=0.00..327.96 rows=4,859 width=112) (actual time=617.563..619.218 rows=100 loops=1)

  • Filter: (doc_management_request_az_id >= $3)
  • Rows Removed by Filter: 234