explain.depesz.com

PostgreSQL's explain analyze made readable

Result: asO9t

Settings
# exclusive inclusive rows x rows loops node
1. 299.603 32,646.282 ↑ 1.0 1 1

Aggregate (cost=3,516,871.43..3,516,871.44 rows=1 width=8) (actual time=32,646.282..32,646.282 rows=1 loops=1)

2. 2,430.138 32,346.679 ↑ 8.3 1,389,952 1

GroupAggregate (cost=2,885,720.47..3,373,428.03 rows=11,475,472 width=194) (actual time=25,627.264..32,346.679 rows=1,389,952 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. 10,320.045 29,916.541 ↑ 3.3 3,529,663 1

Sort (cost=2,885,720.47..2,914,409.15 rows=11,475,472 width=82) (actual time=25,627.243..29,916.541 rows=3,529,663 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. 3,562.712 19,596.496 ↑ 3.3 3,529,663 1

Hash Right Join (cost=413,917.66..990,981.75 rows=11,475,472 width=82) (actual time=16,021.638..19,596.496 rows=3,529,663 loops=1)

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

Index Only Scan using transactions_billing_record_price_factors_salary_event_idx on transactions_billing_record_price_factors (cost=0.29..206,195.94 rows=11,475,472 width=4) (actual time=0.018..17.477 rows=24,458 loops=1)

  • Heap Fetches: 24458
6. 2,732.243 16,016.307 ↑ 1.0 3,529,663 1

Hash (cost=318,091.58..318,091.58 rows=3,529,663 width=90) (actual time=16,016.307..16,016.307 rows=3,529,663 loops=1)

  • Buckets: 1048576 Batches: 8 Memory Usage: 55513kB
7. 2,478.195 13,284.064 ↑ 1.0 3,529,663 1

Hash Join (cost=443.78..318,091.58 rows=3,529,663 width=90) (actual time=4.118..13,284.064 rows=3,529,663 loops=1)

  • Hash Cond: (salary_events.location_id = locations.id)
8. 6,499.003 10,805.780 ↑ 1.0 3,529,663 1

Hash Join (cost=436.37..269,551.31 rows=3,529,663 width=79) (actual time=4.018..10,805.780 rows=3,529,663 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. 3,202.923 4,306.767 ↑ 1.0 3,529,663 1

Hash Join (cost=435.26..132,775.75 rows=3,529,663 width=57) (actual time=3.990..4,306.767 rows=3,529,663 loops=1)

  • Hash Cond: (salary_events.user_id = users.id)
10. 1,099.897 1,099.897 ↑ 1.0 3,529,663 1

Seq Scan on salary_events (cost=0.00..83,807.63 rows=3,529,663 width=41) (actual time=0.002..1,099.897 rows=3,529,663 loops=1)

11. 1.891 3.947 ↓ 1.0 5,168 1

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

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

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

13. 0.007 0.010 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 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)

15. 0.043 0.089 ↑ 1.0 107 1

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

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

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