explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 24jA

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 33,097.140 ↓ 4.0 4 1

Limit (cost=214,820.16..214,820.17 rows=1 width=326) (actual time=33,097.138..33,097.140 rows=4 loops=1)

2. 0.126 33,097.132 ↓ 4.0 4 1

Sort (cost=214,820.16..214,820.17 rows=1 width=326) (actual time=33,097.132..33,097.132 rows=4 loops=1)

  • Sort Key: (to_date((dicomstudies.studydate)::text, 'YYYYMMDD'::text)), (CASE WHEN ((dicomstudies.pname IS NULL) OR ((dicomstudies.pname)::text = ''::text)) THEN (replace((dicomstudies.patientnam)::text, '^'::text, ' '::text))::character varying ELSE dicomstudies.pname END), dicomstudies.patientid
  • Sort Method: quicksort Memory: 26kB
3. 0.665 33,097.006 ↓ 4.0 4 1

Nested Loop (cost=214,816.08..214,820.15 rows=1 width=326) (actual time=33,096.403..33,097.006 rows=4 loops=1)

4. 0.050 33,095.501 ↓ 4.0 4 1

HashAggregate (cost=214,811.65..214,811.66 rows=1 width=62) (actual time=33,095.498..33,095.501 rows=4 loops=1)

  • Group Key: dicomstudies_1.studyinsta, dicomstudies_1.calledaet
5. 0.504 33,095.451 ↓ 4.0 4 1

Nested Loop (cost=0.00..214,811.64 rows=1 width=62) (actual time=3,674.941..33,095.451 rows=4 loops=1)

  • Join Filter: ((upper((dicomstudies_1.typ)::text) = upper(r.modality)) AND (upper((CASE WHEN (((dicomstudies_1.pjkier)::text = ''::text) OR ((SubPlan 1) < 1)) THEN 'Inna'::character varying ELSE dicomstudies_1.pjkier END)::text) = upper((r.jkierujaca_nazwa)::text)))
  • Rows Removed by Join Filter: 48
6. 0.412 0.412 ↓ 13.0 13 1

Seq Scan on rights_flat_view r (cost=0.00..35.73 rows=1 width=548) (actual time=0.043..0.412 rows=13 loops=1)

  • Filter: (((username)::text = 'Administrator'::text) AND (operation_id = 6))
  • Rows Removed by Filter: 1236
7. 33,094.412 33,094.412 ↑ 16.5 4 13

Seq Scan on dicomstudies dicomstudies_1 (cost=0.00..214,705.95 rows=66 width=79) (actual time=881.350..2,545.724 rows=4 loops=13)

  • Filter: (((calledaet)::text = 'ARPACS'::text) AND ((deleted)::text = '0'::text) AND (archonline = 1) AND (((pname)::text ~~* 'g%'::text) OR ((patientnam)::text ~~* 'g%'::text) OR ((patientnam)::text ~~* 'g%'::text)) AND (to_date(replace((studydate)::text, '-'::text, ''::text), 'YYYYMMDD'::text) >= to_date('20200210'::text, 'YYYYMMDD'::text)) AND (to_date(replace((studydate)::text, '-'::text, ''::text), 'YYYYMMDD'::text) <= to_date('20200210'::text, 'YYYYMMDD'::text)))
  • Rows Removed by Filter: 82237
8.          

SubPlan (for Nested Loop)

9. 0.060 0.123 ↑ 1.0 1 3

Aggregate (cost=1.02..1.03 rows=1 width=0) (actual time=0.041..0.041 rows=1 loops=3)

10. 0.063 0.063 ↓ 0.0 0 3

Seq Scan on jkierujaca (cost=0.00..1.02 rows=1 width=0) (actual time=0.021..0.021 rows=0 loops=3)

  • Filter: (upper((nazwa)::text) = upper((dicomstudies_1.pjkier)::text))
  • Rows Removed by Filter: 1
11. 0.036 0.840 ↑ 1.0 1 4

Bitmap Heap Scan on dicomstudies (cost=4.43..8.44 rows=1 width=278) (actual time=0.210..0.210 rows=1 loops=4)

  • Recheck Cond: (((studyinsta)::text = (dicomstudies_1.studyinsta)::text) AND ((calledaet)::text = (dicomstudies_1.calledaet)::text))
  • Heap Blocks: exact=4
12. 0.804 0.804 ↑ 1.0 1 4

Bitmap Index Scan on dicomstudies_pkey (cost=0.00..4.43 rows=1 width=0) (actual time=0.201..0.201 rows=1 loops=4)

  • Index Cond: (((studyinsta)::text = (dicomstudies_1.studyinsta)::text) AND ((calledaet)::text = (dicomstudies_1.calledaet)::text))
Planning time : 3.404 ms
Execution time : 33,097.960 ms