explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Jyr7

Settings
# exclusive inclusive rows x rows loops node
1. 0.023 2.750 ↓ 5.4 27 1

Sort (cost=485.15..485.16 rows=5 width=660) (actual time=2.749..2.750 rows=27 loops=1)

  • Sort Key: (min(sr.received_at)) DESC, w.number DESC, s.number DESC
  • Sort Method: quicksort Memory: 32kB
2. 0.062 2.727 ↓ 5.4 27 1

GroupAggregate (cost=484.88..485.09 rows=5 width=660) (actual time=2.668..2.727 rows=27 loops=1)

  • Group Key: w.number, s.number, sr.description, sr.lab_matrix_id, lm.name, fsd.department_id, d.name, sp.functional_structure_id, fs.name
3. 0.227 2.665 ↓ 16.4 82 1

Sort (cost=484.88..484.89 rows=5 width=660) (actual time=2.661..2.665 rows=82 loops=1)

  • Sort Key: w.number DESC, s.number DESC, sr.description, sr.lab_matrix_id, lm.name, fsd.department_id, d.name, sp.functional_structure_id, fs.name
  • Sort Method: quicksort Memory: 43kB
4. 0.088 2.438 ↓ 16.4 82 1

Nested Loop (cost=1.72..484.82 rows=5 width=660) (actual time=0.106..2.438 rows=82 loops=1)

  • Join Filter: (fsd.department_id = d.id)
  • Rows Removed by Join Filter: 570
5. 0.009 2.268 ↓ 16.4 82 1

Nested Loop (cost=1.72..483.14 rows=5 width=144) (actual time=0.087..2.268 rows=82 loops=1)

6. 0.055 2.095 ↓ 16.4 82 1

Nested Loop (cost=1.58..482.29 rows=5 width=144) (actual time=0.077..2.095 rows=82 loops=1)

7. 0.069 1.958 ↓ 16.4 82 1

Nested Loop (cost=1.44..481.49 rows=5 width=89) (actual time=0.069..1.958 rows=82 loops=1)

8. 0.039 1.807 ↓ 16.4 82 1

Nested Loop (cost=1.29..480.66 rows=5 width=68) (actual time=0.062..1.807 rows=82 loops=1)

9. 0.036 1.604 ↓ 16.4 82 1

Nested Loop (cost=1.00..478.96 rows=5 width=29) (actual time=0.054..1.604 rows=82 loops=1)

10. 0.052 1.404 ↓ 16.4 82 1

Nested Loop (cost=0.71..477.38 rows=5 width=21) (actual time=0.046..1.404 rows=82 loops=1)

11. 1.286 1.286 ↓ 11.0 11 1

Index Scan using idx_work_orders_customer_id_received_at on work_orders w (cost=0.29..467.05 rows=1 width=9) (actual time=0.031..1.286 rows=11 loops=1)

  • Index Cond: ((received_at >= '2020-05-31 23:59:59'::timestamp without time zone) AND (received_at <= '2020-06-30 23:59:59'::timestamp without time zone))
  • Filter: active
12. 0.066 0.066 ↑ 1.6 7 11

Index Scan using index_sample_parameters_work_order_id on sample_parameters sp (cost=0.42..10.22 rows=11 width=20) (actual time=0.004..0.006 rows=7 loops=11)

  • Index Cond: (work_order_id = w.id)
13. 0.164 0.164 ↑ 1.0 1 82

Index Scan using samples_pkey on samples s (cost=0.29..0.32 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=82)

  • Index Cond: (id = sp.sample_id)
14. 0.164 0.164 ↑ 1.0 1 82

Index Scan using sample_registrations_pkey on sample_registrations sr (cost=0.29..0.34 rows=1 width=47) (actual time=0.002..0.002 rows=1 loops=82)

  • Index Cond: (id = s.registration_id)
  • Filter: active
15. 0.082 0.082 ↑ 1.0 1 82

Index Scan using lab_matrices_pkey on lab_matrices lm (cost=0.15..0.17 rows=1 width=25) (actual time=0.001..0.001 rows=1 loops=82)

  • Index Cond: (id = sr.lab_matrix_id)
16. 0.082 0.082 ↑ 1.0 1 82

Index Scan using functional_structures_pkey on functional_structures fs (cost=0.14..0.16 rows=1 width=55) (actual time=0.001..0.001 rows=1 loops=82)

  • Index Cond: (id = sp.functional_structure_id)
17. 0.164 0.164 ↑ 1.0 1 82

Index Only Scan using pk_functional_structures_departments on functional_structures_departments fsd (cost=0.14..0.16 rows=1 width=8) (actual time=0.001..0.002 rows=1 loops=82)

  • Index Cond: (functional_structure_id = sp.functional_structure_id)
  • Heap Fetches: 82
18. 0.071 0.082 ↑ 1.1 8 82

Materialize (cost=0.00..1.14 rows=9 width=520) (actual time=0.000..0.001 rows=8 loops=82)

19. 0.011 0.011 ↑ 1.0 9 1

Seq Scan on departments d (cost=0.00..1.09 rows=9 width=520) (actual time=0.009..0.011 rows=9 loops=1)