explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Q4hU : Optimization for: plan #8xh

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.215 38,244.469 ↑ 1.4 1,681 1

Sort (cost=7,731,874.61..7,731,880.70 rows=2,436 width=211) (actual time=38,244.237..38,244.469 rows=1,681 loops=1)

  • Sort Key: s.study_datetime DESC
  • Sort Method: quicksort Memory: 472kB
2. 547.678 38,244.254 ↑ 1.4 1,681 1

Gather (cost=1,094.00..7,731,737.58 rows=2,436 width=211) (actual time=109.940..38,244.254 rows=1,681 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 7.949 37,676.404 ↑ 1.8 560 3

Nested Loop (cost=94.00..7,724,096.60 rows=1,015 width=118) (actual time=98.223..37,676.404 rows=560 loops=3)

4. 37,650.658 37,668.445 ↑ 1.8 560 3

Parallel Bitmap Heap Scan on study s (cost=93.58..7,719,460.87 rows=1,015 width=77) (actual time=98.174..37,668.445 rows=560 loops=3)

  • Recheck Cond: (study_datetime >= (('now'::cstring)::date - '30 days'::interval))
  • Filter: (NOT (SubPlan 3))
  • Rows Removed by Filter: 1135
  • Heap Blocks: exact=231
5. 0.574 0.574 ↓ 1.0 5,088 1

Bitmap Index Scan on study_datetime (cost=0.00..92.97 rows=4,872 width=0) (actual time=0.574..0.574 rows=5,088 loops=1)

  • Index Cond: (study_datetime >= (('now'::cstring)::date - '30 days'::interval))
6.          

SubPlan (for Parallel Bitmap Heap Scan)

7. 0.000 17.213 ↑ 2.1 63,873 5,085

Materialize (cost=0.00..7,258.90 rows=134,830 width=8) (actual time=0.002..17.213 rows=63,873 loops=5,085)

8. 29.914 29.914 ↑ 2.0 66,315 1,920

Seq Scan on ris_ficha (cost=0.00..6,057.75 rows=134,830 width=8) (actual time=0.003..29.914 rows=66,315 loops=1,920)

  • Filter: (study_fk IS NOT NULL)
  • Rows Removed by Filter: 25
9. 0.010 0.010 ↑ 1.0 1 1,681

Index Scan using patient_pk on patient p (cost=0.42..4.57 rows=1 width=57) (actual time=0.010..0.010 rows=1 loops=1,681)

  • Index Cond: (pk = s.patient_fk)
10.          

SubPlan (for Gather)

11. 1.681 13.448 ↑ 1.0 1 1,681

Limit (cost=0.43..1.28 rows=1 width=6) (actual time=0.007..0.008 rows=1 loops=1,681)

12. 11.767 11.767 ↑ 14.0 1 1,681

Index Scan using study_fk on series (cost=0.43..12.32 rows=14 width=6) (actual time=0.006..0.007 rows=1 loops=1,681)

  • Index Cond: (study_fk = s.pk)
  • Filter: (src_aet IS NOT NULL)
13. 0.000 6.724 ↑ 1.0 1 1,681

Limit (cost=0.43..1.34 rows=1 width=18) (actual time=0.004..0.004 rows=1 loops=1,681)

14. 6.724 6.724 ↑ 13.0 1 1,681

Index Scan using study_fk on series series_1 (cost=0.43..12.32 rows=13 width=18) (actual time=0.004..0.004 rows=1 loops=1,681)

  • Index Cond: (study_fk = s.pk)
  • Filter: ((src_aet IS NOT NULL) AND (institution IS NOT NULL))
  • Rows Removed by Filter: 1
Planning time : 0.817 ms