explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TwoR

Settings
# exclusive inclusive rows x rows loops node
1. 806.862 806.862 ↑ 9.0 1 1

CTE Scan on previous_current_next (cost=63,536.90..63,576.50 rows=9 width=100) (actual time=802.402..806.862 rows=1 loops=1)

  • Filter: (current_article_id = 'LEGIARTI000006594341'::text)
  • Rows Removed by Filter: 9316
2.          

CTE structure_by_legislation

3. 27.443 785.800 ↓ 5.3 9,317 1

Nested Loop Left Join (cost=0.43..63,371.62 rows=1,760 width=25) (actual time=0.181..785.800 rows=9,317 loops=1)

  • Filter: (((joined.initial_version <> 'LEGIARTI000006594341'::text) AND (joined.state = 'VIGUEUR'::text)) OR ((joined.state = 'ABROGE_DIFF'::text) AND (joined.ending_date > now())) OR (structure.article_id = 'LEGIARTI000006594341'::text))
  • Rows Removed by Filter: 19951
4. 114.461 114.461 ↓ 5.9 29,268 1

Seq Scan on articles_legislations_structure structure (cost=0.00..24,269.81 rows=4,923 width=25) (actual time=0.130..114.461 rows=29,268 loops=1)

  • Filter: (legislation_id = 'LEGITEXT000006071367'::text)
  • Rows Removed by Filter: 800401
5. 643.896 643.896 ↑ 1.0 1 29,268

Index Scan using articles_pkey on articles joined (cost=0.43..7.92 rows=1 width=52) (actual time=0.022..0.022 rows=1 loops=29,268)

  • Index Cond: (structure.article_id = article_id)
6.          

CTE previous_current_next

7. 5.973 802.295 ↓ 5.3 9,317 1

WindowAgg (cost=130.08..165.28 rows=1,760 width=100) (actual time=795.425..802.295 rows=9,317 loops=1)

8. 4.687 796.322 ↓ 5.3 9,317 1

Sort (cost=130.08..134.48 rows=1,760 width=36) (actual time=795.413..796.322 rows=9,317 loops=1)

  • Sort Key: s.global_order
  • Sort Method: quicksort Memory: 1112kB
9. 791.635 791.635 ↓ 5.3 9,317 1

CTE Scan on structure_by_legislation s (cost=0.00..35.20 rows=1,760 width=36) (actual time=0.183..791.635 rows=9,317 loops=1)