explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gzJP : Optimization for: After; plan #1PsG

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 7.701 7.701 ↑ 9.0 1 1

CTE Scan on previous_current_next (cost=13,411.66..13,454.21 rows=9 width=96) (actual time=7.689..7.701 rows=1 loops=1)

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

CTE structure_by_legislation

3. 0.906 1.488 ↓ 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.602..1.488 rows=8,069 loops=1)

  • Recheck Cond: (legislation_id = 'LEGITEXT000023086525'::text)
  • Heap Blocks: exact=163
4. 0.582 0.582 ↓ 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.582..0.582 rows=8,069 loops=1)

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

CTE previous_current_next

6. 0.022 7.697 ↑ 135.1 14 1

WindowAgg (cost=1,830.25..1,868.07 rows=1,891 width=100) (actual time=7.682..7.697 rows=14 loops=1)

7. 0.009 7.675 ↑ 135.1 14 1

Sort (cost=1,830.25..1,834.98 rows=1,891 width=36) (actual time=7.675..7.675 rows=14 loops=1)

  • Sort Key: structure_1.global_order
  • Sort Method: quicksort Memory: 26kB
8. 1.082 7.666 ↑ 135.1 14 1

Hash Join (cost=1,346.35..1,727.33 rows=1,891 width=36) (actual time=4.317..7.666 rows=14 loops=1)

  • Hash Cond: (structure_1.article_id = joined.article_id)
  • Join Filter: (((joined.initial_version <> 'LEGIARTI000023086394'::text) AND (joined.state = 'VIGUEUR'::text)) OR ((joined.state = 'ABROGE_DIFF'::text) AND (joined.ending_date > now())) OR (structure_1.article_id = 'LEGIARTI000023080663'::text))
  • Rows Removed by Join Filter: 19
9. 3.013 3.013 ↓ 1.0 8,069 1

CTE Scan on structure_by_legislation structure_1 (cost=0.00..156.30 rows=7,815 width=36) (actual time=0.602..3.013 rows=8,069 loops=1)

10. 0.887 3.571 ↑ 1.0 3,749 1

Hash (cost=1,299.49..1,299.49 rows=3,749 width=52) (actual time=3.571..3.571 rows=3,749 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 347kB
11. 2.684 2.684 ↑ 1.0 3,749 1

Seq Scan on articles joined (cost=0.00..1,299.49 rows=3,749 width=52) (actual time=0.110..2.684 rows=3,749 loops=1)