explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sYL5

Settings
# exclusive inclusive rows x rows loops node
1. 472.891 39,850.887 ↑ 1.0 1 1

Aggregate (cost=1,174,236.59..1,174,236.60 rows=1 width=8) (actual time=39,850.887..39,850.887 rows=1 loops=1)

2. 3,743.600 39,377.996 ↑ 2.5 1,389,957 1

GroupAggregate (cost=980,487.54..1,130,202.71 rows=3,522,710 width=194) (actual time=33,641.307..39,377.996 rows=1,389,957 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. 11,561.159 35,634.396 ↓ 1.0 3,529,669 1

Sort (cost=980,487.54..989,294.31 rows=3,522,710 width=82) (actual time=33,641.288..35,634.396 rows=3,529,669 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: 265656kB
4. 4,171.702 24,073.237 ↓ 1.0 3,529,669 1

Hash Join (cost=444.50..428,853.08 rows=3,522,710 width=82) (actual time=4.246..24,073.237 rows=3,529,669 loops=1)

  • Hash Cond: (salary_events.location_id = locations.id)
5. 10,357.614 19,901.447 ↓ 1.0 3,529,669 1

Hash Join (cost=437.09..371,601.63 rows=3,522,710 width=75) (actual time=4.148..19,901.447 rows=3,529,669 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))
6. 3,553.226 9,543.826 ↓ 1.0 3,529,669 1

Hash Join (cost=435.98..235,095.51 rows=3,522,710 width=53) (actual time=4.121..9,543.826 rows=3,529,669 loops=1)

  • Hash Cond: (salary_events.user_id = users.id)
7. 3,444.649 5,986.560 ↓ 1.0 3,529,669 1

Merge Left Join (cost=0.72..186,222.99 rows=3,522,710 width=37) (actual time=0.042..5,986.560 rows=3,529,669 loops=1)

  • Merge Cond: (salary_events.id = transactions_billing_record_price_factors.salary_event_id)
8. 2,518.304 2,518.304 ↓ 1.0 3,529,669 1

Index Scan using salary_events_pkey on salary_events (cost=0.43..177,161.97 rows=3,522,710 width=41) (actual time=0.016..2,518.304 rows=3,529,669 loops=1)

9. 23.607 23.607 ↑ 459.7 24,462 1

Index Only Scan using transactions_billing_record_price_factors_salary_event_idx on transactions_billing_record_price_factors (cost=0.29..535.92 rows=11,245,307 width=4) (actual time=0.022..23.607 rows=24,462 loops=1)

  • Heap Fetches: 0
10. 1.940 4.040 ↓ 1.0 5,168 1

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

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

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

12. 0.004 0.007 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
13. 0.003 0.003 ↑ 1.0 5 1

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

14. 0.036 0.088 ↑ 1.0 107 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
15. 0.052 0.052 ↑ 1.0 107 1

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