explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vp4T

Settings
# exclusive inclusive rows x rows loops node
1. 286.891 27,255.937 ↑ 1.0 1 1

Aggregate (cost=3,516,074.60..3,516,074.61 rows=1 width=8) (actual time=27,255.937..27,255.937 rows=1 loops=1)

2. 2,288.465 26,969.046 ↑ 8.3 1,389,955 1

GroupAggregate (cost=2,884,919.24..3,372,630.20 rows=11,475,552 width=194) (actual time=20,671.137..26,969.046 rows=1,389,955 loops=1)

  • Group Key: ((salary_events.created_at)::date), salary_events.payment_id, salary_events.user_id, salary_events.location_id, salary_events.export_id, salary_events.salary_kind_id, locations.name, users.first_name, users.last_name, salary_kinds.name, salary_events.status
3. 8,576.193 24,680.581 ↑ 3.3 3,529,666 1

Sort (cost=2,884,919.24..2,913,608.12 rows=11,475,552 width=82) (actual time=20,671.116..24,680.581 rows=3,529,666 loops=1)

  • Sort Key: ((salary_events.created_at)::date), salary_events.payment_id, salary_events.user_id, salary_events.location_id, salary_events.export_id, salary_events.salary_kind_id, locations.name, users.first_name, users.last_name, salary_kinds.name, salary_events.status
  • Sort Method: external merge Disk: 265648kB
4. 2,902.914 16,104.388 ↑ 3.3 3,529,666 1

Hash Right Join (cost=413,198.58..990,167.06 rows=11,475,552 width=82) (actual time=13,193.169..16,104.388 rows=3,529,666 loops=1)

  • Hash Cond: (transactions_billing_record_price_factors.salary_event_id = salary_events.id)
5. 13.109 13.109 ↑ 469.2 24,459 1

Index Only Scan using transactions_billing_record_price_factors_salary_event_idx on transactions_billing_record_price_factors (cost=0.29..206,200.73 rows=11,475,552 width=4) (actual time=0.018..13.109 rows=24,459 loops=1)

  • Heap Fetches: 24459
6. 2,233.918 13,188.365 ↓ 1.0 3,529,666 1

Hash (cost=317,561.42..317,561.42 rows=3,522,710 width=90) (actual time=13,188.365..13,188.365 rows=3,529,666 loops=1)

  • Buckets: 1048576 Batches: 8 Memory Usage: 55513kB
7. 2,021.949 10,954.447 ↓ 1.0 3,529,666 1

Hash Join (cost=443.78..317,561.42 rows=3,522,710 width=90) (actual time=4.153..10,954.447 rows=3,529,666 loops=1)

  • Hash Cond: (salary_events.location_id = locations.id)
8. 5,450.609 8,932.411 ↓ 1.0 3,529,666 1

Hash Join (cost=436.37..269,116.74 rows=3,522,710 width=79) (actual time=4.057..8,932.411 rows=3,529,666 loops=1)

  • Hash Cond: (salary_events.salary_kind_id = salary_kinds.id)
  • Join Filter: (((salary_events.payment_id)::text ~~* '%1%'::text) OR ((salary_events.created_at)::text ~~* '%1%'::text) OR (((users.first_name)::text || COALESCE((' '::text || (users.last_name)::text), ''::text)) ~~* '%1%'::text) OR ((salary_kinds.name)::text ~~* '%1%'::text))
9. 2,485.346 3,481.793 ↓ 1.0 3,529,666 1

Hash Join (cost=435.26..132,610.62 rows=3,522,710 width=57) (actual time=4.033..3,481.793 rows=3,529,666 loops=1)

  • Hash Cond: (salary_events.user_id = users.id)
10. 992.458 992.458 ↓ 1.0 3,529,666 1

Seq Scan on salary_events (cost=0.00..83,738.10 rows=3,522,710 width=41) (actual time=0.002..992.458 rows=3,529,666 loops=1)

11. 1.893 3.989 ↓ 1.0 5,168 1

Hash (cost=370.67..370.67 rows=5,167 width=20) (actual time=3.989..3.989 rows=5,168 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 336kB
12. 2.096 2.096 ↓ 1.0 5,168 1

Seq Scan on users (cost=0.00..370.67 rows=5,167 width=20) (actual time=0.003..2.096 rows=5,168 loops=1)

13. 0.007 0.009 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=26) (actual time=0.009..0.009 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.002 0.002 ↑ 1.0 5 1

Seq Scan on salary_kinds (cost=0.00..1.05 rows=5 width=26) (actual time=0.002..0.002 rows=5 loops=1)

15. 0.037 0.087 ↑ 1.0 107 1

Hash (cost=6.07..6.07 rows=107 width=15) (actual time=0.087..0.087 rows=107 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
16. 0.050 0.050 ↑ 1.0 107 1

Seq Scan on locations (cost=0.00..6.07 rows=107 width=15) (actual time=0.006..0.050 rows=107 loops=1)