explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KADY : Optimization for: plan #eoiOJ

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.039 0.449 ↑ 4.5 2 1

Sort (cost=61.84..61.87 rows=9 width=597) (actual time=0.449..0.449 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.052 0.410 ↑ 4.5 2 1

GroupAggregate (cost=61.30..61.70 rows=9 width=597) (actual time=0.391..0.410 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.038 0.358 ↓ 11.8 106 1

Sort (cost=61.30..61.32 rows=9 width=537) (actual time=0.353..0.358 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.014 0.320 ↓ 11.8 106 1

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

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

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

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

Seq Scan on public.employees e (cost=0.00..11.32 rows=32 width=13) (actual time=0.004..0.025 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.003 0.018 ↓ 2.0 2 1

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

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

Seq Scan on public.clients c (cost=0.00..10.12 rows=1 width=524) (actual time=0.012..0.015 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.240 0.240 ↓ 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.008..0.020 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