explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ibDs

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

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

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

CTE structure_by_legislation

3. 30.306 833.626 ↓ 5.3 9,317 1

Nested Loop Left Join (cost=0.43..63,371.62 rows=1,760 width=25) (actual time=0.156..833.626 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. 130.156 130.156 ↓ 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.126..130.156 rows=29,268 loops=1)

  • Filter: (legislation_id = 'LEGITEXT000006071367'::text)
  • Rows Removed by Filter: 800401
5. 673.164 673.164 ↑ 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.023..0.023 rows=1 loops=29,268)

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

CTE previous_current_next

7. 6.304 851.448 ↓ 5.3 9,317 1

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

8. 4.994 845.144 ↓ 5.3 9,317 1

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

  • Sort Key: s.global_order
  • Sort Method: quicksort Memory: 1112kB
9. 840.150 840.150 ↓ 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.158..840.150 rows=9,317 loops=1)