explain.depesz.com

PostgreSQL's explain analyze made readable

Result: eoiOJ

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.034 0.950 ↑ 4.5 2 1

Sort (cost=61.84..61.87 rows=9 width=597) (actual time=0.950..0.950 rows=2 loops=1)

  • Output: c.client_group_id, (((((c.name)::text || ' ('::text) || (c.id)::text) || ')'::text)), (((((e.number)::text || ' ('::text) || (e.id)::text) || ')'::text)), e.id, c.name, c.id, e.number
  • Sort Key: c.client_group_id, (((((c.name)::text || ' ('::text) || (c.id)::text) || ')'::text)), (((((e.number)::text || ' ('::text) || (e.id)::text) || ')'::text))
  • Sort Method: quicksort Memory: 25kB
2. 0.138 0.916 ↑ 4.5 2 1

GroupAggregate (cost=61.30..61.70 rows=9 width=597) (actual time=0.851..0.916 rows=2 loops=1)

  • Output: c.client_group_id, ((((c.name)::text || ' ('::text) || (c.id)::text) || ')'::text), ((((e.number)::text || ' ('::text) || (e.id)::text) || ')'::text), e.id, c.name, c.id, e.number
  • Group Key: e.id, c.id
  • Filter: (count(DISTINCT p.id) > 52)
3. 0.141 0.778 ↓ 11.8 106 1

Sort (cost=61.30..61.32 rows=9 width=537) (actual time=0.763..0.778 rows=106 loops=1)

  • Output: e.id, c.id, c.client_group_id, c.name, e.number, p.id
  • Sort Key: e.id, c.id
  • Sort Method: quicksort Memory: 39kB
4. 0.064 0.637 ↓ 11.8 106 1

Nested Loop (cost=10.41..61.15 rows=9 width=537) (actual time=0.108..0.637 rows=106 loops=1)

  • Output: e.id, c.id, c.client_group_id, c.name, e.number, p.id
5. 0.075 0.141 ↓ 4.0 12 1

Hash Join (cost=10.14..21.57 rows=3 width=533) (actual time=0.076..0.141 rows=12 loops=1)

  • Output: e.number, e.id, c.client_group_id, c.name, c.id
  • Inner Unique: true
  • Hash Cond: (e.client_id = c.id)
6. 0.038 0.038 ↑ 1.0 32 1

Seq Scan on public.employees e (cost=0.00..11.32 rows=32 width=13) (actual time=0.010..0.038 rows=32 loops=1)

  • Output: e.id, e.first_name, e.last_name, e.birthdate, e.wave_id, e.payment_method, e.bank_account_id, e.physical_address, e.postal_address, e.trading_name, e.hourly_paid, e.take_on_object, e.created_at, e.updated_at, e.client_id, e.id_number, e.other_number, e.income_tax_number, e.job_title, e.cell_no, e.email, e.self_service, e.bus_tel_no, e.passport_country_code, e.pay_point_id, e.additional_number, e.job_grade_id, e.identification_type, e.gender, e.classification_inputs, e.country_code, e.attribs, e.number, e.number_is_manual, e.deleted, e.take_on_attribs, e.has_draft_payslips, e.custom_fields
7. 0.009 0.028 ↓ 2.0 2 1

Hash (cost=10.12..10.12 rows=1 width=524) (actual time=0.028..0.028 rows=2 loops=1)

  • Output: c.client_group_id, c.name, c.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
8. 0.019 0.019 ↓ 2.0 2 1

Seq Scan on public.clients c (cost=0.00..10.12 rows=1 width=524) (actual time=0.011..0.019 rows=2 loops=1)

  • Output: c.client_group_id, c.name, c.id
  • Filter: ((NOT c.demo) AND (NOT c.deleted) AND ((c.country_code)::text = 'za'::text))
  • Rows Removed by Filter: 4
9. 0.432 0.432 ↓ 4.5 9 12

Index Scan using index_payslips_on_employee_id on public.payslips p (cost=0.27..13.17 rows=2 width=8) (actual time=0.017..0.036 rows=9 loops=12)

  • Output: p.id, p.date, p.period_offset, p.employee_id, p.finalised, p.payment_run_id, p.payment_method, p.dirty, p.beneficiary_accounts, p.client_id, p.created_at, p.updated_at, p.employee_snapshot_attributes, p.wave_id, p.override_start_date, p.override_end_date, p.ss_released, p.special, p.manual, p.notes, p.pro_rata_perc_override, p.pay_point_id, p.inputs, p.outputs, p.service_period_start_date, p.service_period_end_date, p.service_period_id, p.ss_emailed, p.classification_hstore, p.employee_snapshot_json, p.beneficiary_amounts, p.structured_outputs
  • Index Cond: (p.employee_id = e.id)
  • Filter: (p.finalised AND (NOT p.special) AND (p.date >= '2017-03-01'::date) AND (p.date <= '2018-02-28'::date))
  • Rows Removed by Filter: 6