explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qR25

Settings
# exclusive inclusive rows x rows loops node
1. 0.017 1.621 ↓ 1.9 13 1

Sort (cost=559.00..559.01 rows=7 width=660) (actual time=1.621..1.621 rows=13 loops=1)

  • Sort Key: (min(sr.received_at)) DESC, w.number DESC, s.number DESC
  • Sort Method: quicksort Memory: 28kB
2. 0.026 1.604 ↓ 1.9 13 1

GroupAggregate (cost=558.60..558.90 rows=7 width=660) (actual time=1.584..1.604 rows=13 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.071 1.578 ↓ 3.1 22 1

Sort (cost=558.60..558.62 rows=7 width=660) (actual time=1.577..1.578 rows=22 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: 30kB
4. 0.005 1.507 ↓ 3.1 22 1

Nested Loop (cost=1.72..558.50 rows=7 width=660) (actual time=0.264..1.507 rows=22 loops=1)

  • Join Filter: (fsd.department_id = d.id)
  • Rows Removed by Join Filter: 150
5. 0.000 1.458 ↓ 3.1 22 1

Nested Loop (cost=1.72..556.55 rows=7 width=144) (actual time=0.240..1.458 rows=22 loops=1)

6. 0.013 1.415 ↓ 3.1 22 1

Nested Loop (cost=1.58..555.36 rows=7 width=144) (actual time=0.234..1.415 rows=22 loops=1)

7. 0.019 1.380 ↓ 3.1 22 1

Nested Loop (cost=1.43..554.24 rows=7 width=89) (actual time=0.229..1.380 rows=22 loops=1)

8. 0.015 1.335 ↓ 6.5 13 1

Nested Loop (cost=1.01..552.90 rows=2 width=81) (actual time=0.223..1.335 rows=13 loops=1)

9. 0.012 1.307 ↓ 6.5 13 1

Nested Loop (cost=0.87..552.57 rows=2 width=60) (actual time=0.218..1.307 rows=13 loops=1)

10. 0.006 1.269 ↓ 6.5 13 1

Nested Loop (cost=0.58..551.89 rows=2 width=21) (actual time=0.211..1.269 rows=13 loops=1)

11. 1.245 1.245 ↓ 3.0 3 1

Index Scan using idx_work_orders_customer_id_received_at on work_orders w (cost=0.29..548.54 rows=1 width=9) (actual time=0.199..1.245 rows=3 loops=1)

  • Index Cond: ((received_at >= '2020-05-31 23:59:59'::timestamp without time zone) AND (received_at <= '2020-06-01 23:00:00'::timestamp without time zone) AND (received_at <= '2020-06-30 23:59:59'::timestamp without time zone))
  • Filter: active
12. 0.018 0.018 ↓ 2.0 4 3

Index Scan using index_samples_on_work_order_id_state on samples s (cost=0.29..3.33 rows=2 width=20) (actual time=0.004..0.006 rows=4 loops=3)

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

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=13)

  • Index Cond: (id = s.registration_id)
  • Filter: active
14. 0.013 0.013 ↑ 1.0 1 13

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=13)

  • Index Cond: (id = sr.lab_matrix_id)
15. 0.026 0.026 ↑ 3.0 2 13

Index Scan using index_sample_parameters_on_sample_id_and_position on sample_parameters sp (cost=0.42..0.61 rows=6 width=16) (actual time=0.002..0.002 rows=2 loops=13)

  • Index Cond: (sample_id = s.id)
16. 0.022 0.022 ↑ 1.0 1 22

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=22)

  • Index Cond: (id = sp.functional_structure_id)
17. 0.044 0.044 ↑ 1.0 1 22

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=22)

  • Index Cond: (functional_structure_id = sp.functional_structure_id)
  • Heap Fetches: 22
18. 0.030 0.044 ↑ 1.1 8 22

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

19. 0.014 0.014 ↑ 1.0 9 1

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