in reply to OT: peak values with SQL

You might want to consider the last value as a peak. What if your last three values were 6,0,999? 999 wouldn't get counted as a peak because it's not higher than uptime_id +1 because it's the last uptime_id. You probably want to grab the max_id in a separate SQL call, but if you wanted to cram it all into one, you could do this:
SELECT uptime_id, uptime_value
  FROM uptime AS t1
 WHERE uptime_value >( SELECT uptime_value
                         FROM uptime
                        WHERE uptime_id =  t1.uptime_id + 1
                      )
    OR uptime_id    = ( SELECT MAX(uptime_id) FROM uptime )
update nonsense example omitted
update 2 removed the strikeouts from the example, on second thought it isn't nonsense, it's a valid concern