explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1PsG : After

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 77.710 77.710 ↑ 1.0 1 1

CTE Scan on previous_current_next (cost=11,996.33..11,996.53 rows=1 width=96) (actual time=77.696..77.710 rows=1 loops=1)

  • Filter: (article_id = 'LEGIARTI000023080663'::text)
  • Rows Removed by Filter: 13
2.          

CTE structure_by_legislation

3. 1.018 1.611 ↓ 1.0 8,069 1

Bitmap Heap Scan on articles_legislations_structure structure (cost=216.99..11,543.59 rows=7,815 width=79) (actual time=0.613..1.611 rows=8,069 loops=1)

  • Recheck Cond: (legislation_id = 'LEGITEXT000023086525'::text)
  • Heap Blocks: exact=163
4. 0.593 0.593 ↓ 1.0 8,069 1

Bitmap Index Scan on legislation_id_index (cost=0.00..215.04 rows=7,815 width=0) (actual time=0.593..0.593 rows=8,069 loops=1)

  • Index Cond: (legislation_id = 'LEGITEXT000023086525'::text)
5.          

CTE previous_current_next

6. 0.024 77.699 ↓ 1.6 14 1

WindowAgg (cost=452.56..452.74 rows=9 width=100) (actual time=77.685..77.699 rows=14 loops=1)

7. 0.011 77.675 ↓ 1.6 14 1

Sort (cost=452.56..452.58 rows=9 width=36) (actual time=77.675..77.675 rows=14 loops=1)

  • Sort Key: structure_1.global_order
  • Sort Method: quicksort Memory: 26kB
8. 1.172 77.664 ↓ 1.6 14 1

Nested Loop (cost=0.28..452.41 rows=9 width=36) (actual time=1.635..77.664 rows=14 loops=1)

9. 3.871 3.871 ↓ 206.9 8,069 1

CTE Scan on structure_by_legislation structure_1 (cost=0.00..175.84 rows=39 width=36) (actual time=0.617..3.871 rows=8,069 loops=1)

  • Filter: (legislation_id = 'LEGITEXT000023086525'::text)
10. 72.621 72.621 ↓ 0.0 0 8,069

Index Scan using articles_pkey on articles joined (cost=0.28..7.08 rows=1 width=52) (actual time=0.009..0.009 rows=0 loops=8,069)

  • Index Cond: (article_id = structure_1.article_id)
  • Filter: (((initial_version <> 'LEGIARTI000023086394'::text) AND (state = 'VIGUEUR'::text)) OR ((state = 'ABROGE_DIFF'::text) AND (ending_date > now())) OR (structure_1.article_id = 'LEGIARTI000023080663'::text))
  • Rows Removed by Filter: 0