Postgres get rows where a field stopps growing
Use the window function lead() in a subquery:

SELECT id, device_id, uptime
FROM  (
   SELECT *, lead(uptime) OVER (PARTITION BY device_id ORDER BY id) AS next_uptime
   FROM   tbl
   ) sub
WHERE  next_uptime &lt; uptime


BTW, "where a field stops growing" would translate to &lt;=, but "where the next row's timestamp is smaller" requires &lt;.