explain.depesz.com

PostgreSQL's explain analyze made readable

Result: zqRj

Settings
# exclusive inclusive rows x rows loops node
1. 0.385 47,558.453 ↑ 1.0 50 1

Limit (cost=4,537,430.21..4,537,430.34 rows=50 width=21) (actual time=47,557.918..47,558.453 rows=50 loops=1)

2. 9,441.684 47,558.068 ↑ 9,941.2 50 1

Sort (cost=4,537,430.21..4,538,672.87 rows=497,062 width=21) (actual time=47,557.911..47,558.068 rows=50 loops=1)

  • Sort Key: employees.created_at_t DESC, employees._id_x DESC
  • Sort Method: top-N heapsort Memory: 31kB
3. 20,934.272 38,116.384 ↓ 2.0 999,999 1

Bitmap Heap Scan on employees (cost=31,847.56..4,520,918.17 rows=497,062 width=21) (actual time=1,186.449..38,116.384 rows=999,999 loops=1)

  • Recheck Cond: ((company_id_s)::text = '5d1898837ed7aa1b349fc246'::text)
  • Filter: ((status_i <> 3) AND (SubPlan 1))
  • Rows Removed by Filter: 1
  • Heap Blocks: exact=24854
4. 1,182.128 1,182.128 ↓ 1.0 1,000,000 1

Bitmap Index Scan on employees_company_id_s_status_i_idx (cost=0.00..31,723.29 rows=997,715 width=0) (actual time=1,182.122..1,182.128 rows=1,000,000 loops=1)

  • Index Cond: ((company_id_s)::text = '5d1898837ed7aa1b349fc246'::text)
5.          

SubPlan (forBitmap Heap Scan)

6. 15,999.984 15,999.984 ↑ 1.0 1 999,999

Index Scan using employees_cv_histories_did_seq_idx on employees_cv_histories (cost=0.43..8.45 rows=1 width=4) (actual time=0.016..0.016 rows=1 loops=999,999)

  • Index Cond: (did = employees.did)
  • Filter: ((created_at_t > '2017-12-31 22:00:00+00'::timestamp with time zone) AND (created_at_t <= '2019-07-08 21:00:00+00'::timestamp with time zone))
Planning time : 165.033 ms
Execution time : 47,559.496 ms