explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ChBO

Settings
# exclusive inclusive rows x rows loops node
1. 0.124 203.235 ↑ 1.0 1,858 1

Limit (cost=19,923.96..1,920,729.14 rows=1,897 width=2,840) (actual time=102.983..203.235 rows=1,858 loops=1)

2. 14.013 203.111 ↑ 1.0 1,858 1

Bitmap Heap Scan on treatments_details (cost=19,923.96..1,920,729.14 rows=1,897 width=2,840) (actual time=102.982..203.111 rows=1,858 loops=1)

  • Recheck Cond: ((consultation_author = ANY ('{5727,2287,3284,222,5215,4443,516,703,3036,2297,5585,6103,1987,326,1911,1988,1987}'::integer[])) AND (consultation_datetime >= '2019-01-01 00:00:00'::timestamp without time zone) AND (consultation_datetime <= '2019-04-09 23:59:59'::timestamp without time zone))
  • Rows Removed by Index Recheck: 391
  • Filter: (NOT deleted)
  • Rows Removed by Filter: 31
  • Heap Blocks: exact=3228
3. 2.099 99.914 ↓ 0.0 0 1

BitmapAnd (cost=19,923.96..19,923.96 rows=2,003 width=0) (actual time=99.913..99.914 rows=0 loops=1)

4. 15.241 15.241 ↓ 2.1 177,370 1

Bitmap Index Scan on treatments_details_consultation_author_idx (cost=0.00..2,949.84 rows=84,305 width=0) (actual time=15.241..15.241 rows=177,370 loops=1)

  • Index Cond: (consultation_author = ANY ('{5727,2287,3284,222,5215,4443,516,703,3036,2297,5585,6103,1987,326,1911,1988,1987}'::integer[]))
5. 82.574 82.574 ↓ 1.8 801,667 1

Bitmap Index Scan on treatments_details_consultation_datetime_idx (cost=0.00..16,972.93 rows=448,849 width=0) (actual time=82.574..82.574 rows=801,667 loops=1)

  • Index Cond: ((consultation_datetime >= '2019-01-01 00:00:00'::timestamp without time zone) AND (consultation_datetime <= '2019-04-09 23:59:59'::timestamp without time zone))
6.          

SubPlan (forBitmap Heap Scan)

7. 1.858 89.184 ↑ 1.0 1 1,858

Limit (cost=997.82..997.82 rows=1 width=8) (actual time=0.047..0.048 rows=1 loops=1,858)

8. 7.432 87.326 ↑ 246.0 1 1,858

Sort (cost=997.82..998.43 rows=246 width=8) (actual time=0.047..0.047 rows=1 loops=1,858)

  • Sort Key: rtd.consultation_datetime DESC
  • Sort Method: top-N heapsort Memory: 25kB
9. 79.894 79.894 ↑ 6.0 41 1,858

Index Scan using treatments_details_patient_id_idx on treatments_details rtd (cost=0.44..996.59 rows=246 width=8) (actual time=0.005..0.043 rows=41 loops=1,858)

  • Index Cond: (patient_id = treatments_details.patient_id)
  • Filter: (deleted IS NOT TRUE)
  • Rows Removed by Filter: 1
Planning time : 0.375 ms