explain.depesz.com

PostgreSQL's explain analyze made readable

Result: SAeq : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #PTt4; plan #1SCb; plan #3jBG; plan #eE6h; plan #i2qD; plan #tQzX; plan #Mys4; plan #cJmw

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.000 0.197 ↓ 0.0 0 1

Insert on transfer_reagents (cost=264,991.78..265,002.39 rows=1 width=1,104) (actual time=0.197..0.197 rows=0 loops=1)

2.          

CTE to_upsert

3. 0.142 0.142 ↑ 10.0 10 1

Function Scan on json_to_recordset to_upsert (cost=0.00..1.00 rows=100 width=353) (actual time=0.141..0.142 rows=10 loops=1)

4.          

CTE plates

5. 0.000 0.000 ↓ 0.0 0

Unique (cost=252,377.10..252,379.64 rows=203 width=38) (never executed)

6. 0.000 0.000 ↓ 0.0 0

Sort (cost=252,377.10..252,377.61 rows=203 width=38) (never executed)

  • Sort Key: pl.id, pl.barcode, pl.experiment_plate_number, e.label
7. 0.000 0.000 ↓ 0.0 0

Merge Join (cost=15.47..252,369.32 rows=203 width=38) (never executed)

  • Merge Cond: (pl.experiment_id = e.id)
  • Join Filter: ((tu_1.plate_id = pl.id) OR ((tu_1.plate_barcode)::text = (pl.barcode)::text) OR ((tu_1.plate_number = pl.experiment_plate_number) AND ((tu_1.experiment_label)::text = (e.label)::text)))
8. 0.000 0.000 ↓ 0.0 0

Index Scan using unique_experiment_id_and_plate_number on plates pl (cost=0.29..5,163.84 rows=87,871 width=19) (never executed)

9. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.29..32,193.90 rows=1,260,500 width=99) (never executed)

10. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.29..29,042.65 rows=1,260,500 width=99) (never executed)

11. 0.000 0.000 ↓ 0.0 0

Index Scan using experiments_pkey on experiments e (cost=0.29..3,831.65 rows=12,605 width=27) (never executed)

12. 0.000 0.000 ↓ 0.0 0

CTE Scan on to_upsert tu_1 (cost=0.00..2.00 rows=100 width=72) (never executed)

13.          

CTE printings

14. 0.001 0.048 ↓ 0.0 0 1

Unique (cost=869.87..869.88 rows=1 width=20) (actual time=0.048..0.048 rows=0 loops=1)

15. 0.008 0.047 ↓ 0.0 0 1

Sort (cost=869.87..869.87 rows=1 width=20) (actual time=0.047..0.047 rows=0 loops=1)

  • Sort Key: p.id, p.plate_id, p.layer, p.printed_at
  • Sort Method: quicksort Memory: 25kB
16. 0.000 0.039 ↓ 0.0 0 1

Hash Join (cost=7.16..869.86 rows=1 width=20) (actual time=0.039..0.039 rows=0 loops=1)

  • Hash Cond: (p.plate_id = plates_1.id)
17. 0.009 0.039 ↓ 0.0 0 1

Nested Loop (cost=0.56..860.50 rows=100 width=20) (actual time=0.039..0.039 rows=0 loops=1)

18. 0.010 0.010 ↑ 10.0 10 1

CTE Scan on to_upsert tu_2 (cost=0.00..2.00 rows=100 width=4) (actual time=0.001..0.010 rows=10 loops=1)

19. 0.020 0.020 ↓ 0.0 0 10

Index Scan using printings_pkey on printings p (cost=0.56..8.57 rows=1 width=20) (actual time=0.002..0.002 rows=0 loops=10)

  • Index Cond: (id = tu_2.printing_id)
20. 0.000 0.000 ↓ 0.0 0

Hash (cost=4.06..4.06 rows=203 width=4) (never executed)

21. 0.000 0.000 ↓ 0.0 0

CTE Scan on plates plates_1 (cost=0.00..4.06 rows=203 width=4) (never executed)

22.          

CTE deleted_transfers

23. 0.000 0.002 ↓ 0.0 0 1

Delete on transfer_perturbations (cost=0.59..11,123.41 rows=2,847 width=34) (actual time=0.002..0.002 rows=0 loops=1)

24. 0.001 0.002 ↓ 0.0 0 1

Nested Loop (cost=0.59..11,123.41 rows=2,847 width=34) (actual time=0.002..0.002 rows=0 loops=1)

25. 0.001 0.001 ↓ 0.0 0 1

HashAggregate (cost=0.02..0.03 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Group Key: printings_1.id
26. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on printings printings_1 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: (printed_at IS NULL)
27. 0.000 0.000 ↓ 0.0 0

Index Scan using printing_reagents_printing_id_idx on transfer_perturbations (cost=0.56..11,094.91 rows=2,847 width=10) (never executed)

  • Index Cond: (printing_id = printings_1.id)
28.          

CTE new_transfer_perturbations

29. 0.001 0.013 ↓ 0.0 0 1

Insert on transfer_perturbations transfer_perturbations_1 (cost=617.63..617.81 rows=2 width=1,435) (actual time=0.013..0.013 rows=0 loops=1)

30. 0.000 0.012 ↓ 0.0 0 1

Subquery Scan on *SELECT* (cost=617.63..617.81 rows=2 width=1,435) (actual time=0.012..0.012 rows=0 loops=1)

31. 0.001 0.012 ↓ 0.0 0 1

GroupAggregate (cost=617.63..617.71 rows=2 width=269) (actual time=0.012..0.012 rows=0 loops=1)

  • Group Key: tu_3.well_address, tu_3.src_barcode, tu_3.src_address, tu_3.transfer_volume, printings_2.id, tu_3.condition_id, tu_3.well_type_id, tu_3.control
32. 0.011 0.011 ↓ 0.0 0 1

Sort (cost=617.63..617.63 rows=2 width=237) (actual time=0.011..0.011 rows=0 loops=1)

  • Sort Key: tu_3.well_address, tu_3.src_barcode, tu_3.src_address, tu_3.transfer_volume, printings_2.id, tu_3.condition_id, tu_3.well_type_id, tu_3.control
  • Sort Method: quicksort Memory: 25kB
33. 0.000 0.000 ↓ 0.0 0 1

Nested Loop (cost=0.00..617.62 rows=2 width=237) (actual time=0.000..0.000 rows=0 loops=1)

  • Join Filter: ((printings_2.id = tu_3.printing_id) OR ((((printings_2.layer)::character varying)::text = (tu_3.layer)::text) AND (plates_2.id = printings_2.plate_id)))
34. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on printings printings_2 (cost=0.00..0.02 rows=1 width=12) (actual time=0.000..0.000 rows=0 loops=1)

35. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.00..613.03 rows=203 width=273) (never executed)

  • Join Filter: ((tu_3.plate_id = plates_2.id) OR ((tu_3.plate_barcode)::text = (plates_2.barcode)::text) OR (((tu_3.experiment_label)::text = (plates_2.experiment_label)::text) AND (tu_3.plate_number = plates_2.experiment_plate_number)))
36. 0.000 0.000 ↓ 0.0 0

CTE Scan on to_upsert tu_3 (cost=0.00..2.00 rows=100 width=341) (never executed)

37. 0.000 0.000 ↓ 0.0 0

CTE Scan on plates plates_2 (cost=0.00..4.06 rows=203 width=742) (never executed)

38. 0.001 0.197 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.03..10.65 rows=1 width=1,104) (actual time=0.197..0.197 rows=0 loops=1)

  • Join Filter: ((plates.id = tu.plate_id) OR ((plates.barcode)::text = (tu.plate_barcode)::text) OR (((plates.experiment_label)::text = (tu.experiment_label)::text) AND (plates.experiment_plate_number = tu.plate_number)))
39. 0.001 0.196 ↓ 0.0 0 1

Nested Loop (cost=0.03..2.52 rows=1 width=172) (actual time=0.196..0.196 rows=0 loops=1)

  • Join Filter: ((printings.id = ntp.printing_id) AND ((tu.src_barcode)::text = (ntp.src_plate_barcode)::text) AND ((tu.src_address)::text = (ntp.src_well_address)::text) AND ((tu.well_address)::text = ANY ((ntp.addresses)::text[])))
40. 0.005 0.195 ↓ 0.0 0 1

Hash Join (cost=0.03..2.42 rows=1 width=272) (actual time=0.195..0.195 rows=0 loops=1)

  • Hash Cond: (tu.printing_id = printings.id)
41. 0.141 0.141 ↑ 100.0 1 1

CTE Scan on to_upsert tu (cost=0.00..2.00 rows=100 width=268) (actual time=0.141..0.141 rows=1 loops=1)

42. 0.000 0.049 ↓ 0.0 0 1

Hash (cost=0.02..0.02 rows=1 width=4) (actual time=0.049..0.049 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
43. 0.049 0.049 ↓ 0.0 0 1

CTE Scan on printings (cost=0.00..0.02 rows=1 width=4) (actual time=0.049..0.049 rows=0 loops=1)

44. 0.000 0.000 ↓ 0.0 0

CTE Scan on new_transfer_perturbations ntp (cost=0.00..0.04 rows=2 width=282) (never executed)

45. 0.000 0.000 ↓ 0.0 0

CTE Scan on plates (cost=0.00..4.06 rows=203 width=742) (never executed)