explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QYsH

Settings
# exclusive inclusive rows x rows loops node
1. 0.017 71.677 ↑ 4.0 1 1

Sort (cost=12,448.50..12,448.51 rows=4 width=65) (actual time=68.908..71.677 rows=1 loops=1)

  • Sort Key: (count(surveys.id)) DESC, (sum(CASE surveys.scheduling_date_filter WHEN 1 THEN 1 ELSE 0 END)) DESC, (sum(CASE surveys.scheduling_dat
  • Sort Method: quicksort Memory: 25kB
2. 0.008 71.660 ↑ 4.0 1 1

Finalize GroupAggregate (cost=12,448.38..12,448.46 rows=4 width=65) (actual time=68.891..71.660 rows=1 loops=1)

  • Group Key: users.id
3. 0.009 71.652 ↑ 2.0 1 1

Sort (cost=12,448.38..12,448.39 rows=2 width=65) (actual time=68.884..71.652 rows=1 loops=1)

  • Sort Key: users.id
  • Sort Method: quicksort Memory: 25kB
4. 36.740 71.643 ↑ 2.0 1 1

Gather (cost=12,448.10..12,448.37 rows=2 width=65) (actual time=68.737..71.643 rows=1 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
5. 0.018 34.903 ↓ 0.0 0 2 / 2

Partial GroupAggregate (cost=11,448.10..11,448.17 rows=2 width=65) (actual time=34.901..34.903 rows=0 loops=2)

  • Group Key: users.id
6. 0.061 34.885 ↓ 17.0 34 2 / 2

Sort (cost=11,448.10..11,448.10 rows=2 width=33) (actual time=34.881..34.885 rows=34 loops=2)

  • Sort Key: users.id
  • Sort Method: quicksort Memory: 30kB
7. 0.164 34.824 ↓ 17.0 34 2 / 2

Nested Loop (cost=9.51..11,448.09 rows=2 width=33) (actual time=2.130..34.824 rows=34 loops=2)

8. 31.778 31.778 ↓ 1.0 26 2 / 2

Parallel Seq Scan on users (cost=0.00..1,225.01 rows=25 width=25) (actual time=0.228..31.778 rows=26 loops=2)

  • Filter: ((lower((name)::text) ~~ '%gearl%'::text) OR (lower((last_name)::text) ~~ '%gearl%'::text) OR ((cpf)::text ~~ '%gearl%'::text))
  • Rows Removed by Filter: 6,435
9. 2.346 2.881 ↑ 1.0 1 51 / 2

Bitmap Heap Scan on surveys (cost=9.51..408.91 rows=1 width=12) (actual time=0.109..0.113 rows=1 loops=51)

  • Recheck Cond: (expert_id = users.id)
  • Filter: ((account_owner_id = 1,576) AND (flow_responsible_account_id = 1,576) AND ((current_status)::text = ANY ('{with_expert,with_expert_mobile,budgeting,budgeting_mobile,waiting_agreement,budgeting_by_cilia_pass}'::text[])))
  • Rows Removed by Filter: 23
  • Heap Blocks: exact=658
10. 0.536 0.536 ↑ 6.0 24 51 / 2

Bitmap Index Scan on index_surveys_on_expert_id (cost=0.00..9.51 rows=145 width=0) (actual time=0.021..0.021 rows=24 loops=51)

  • Index Cond: (expert_id = users.id)
Planning time : 2.190 ms
Execution time : 71.963 ms