How to reduce redundant time-series data in MySQL into a function?
YOUR SAMPLE DATA

DROP DATABASE IF EXISTS rep;
CREATE DATABASE rep;
USE rep
CREATE TABLE timeseries
(
    id             INT NOT NULL AUTO_INCREMENT,
    polltime       DATETIME NOT NULL,
    lastupdatetime DATETIME NOT NULL,
    name           VARCHAR(20) NOT NULL,
    value          VARCHAR(20) NOT NULL,
    PRIMARY KEY    (id),
    KEY series_ndx (lastupdatetime,name,value,polltime)
);
INSERT INTO timeseries
(polltime,lastupdatetime,name,value) VALUES
('2016-09-09 15:19:45','2016-09-09 15:19:44','x','15,2'),
('2016-09-09 15:19:50','2016-09-09 15:19:44','x','15,2'),
('2016-09-09 15:19:55','2016-09-09 15:19:44','x','15,2'),
('2016-09-09 15:20:00','2016-09-09 15:19:56','y','16,05'),
('2016-09-09 15:20:05','2016-09-09 15:19:58','c','16,12'),
('2016-09-09 15:20:10','2016-09-09 15:20:12','x','15,98');
SELECT * FROM timeseries;


PROPOSED QUERY

SELECT SEC_TO_TIME(MAX(polltime)-MIN(polltime)) timediff,lastupdatetime,name,value
FROM timeseries GROUP BY lastupdatetime,name,value;


PROPOSED QUERY EXECUTED

mysql&gt; SELECT SEC_TO_TIME(MAX(polltime)-MIN(polltime)) timediff,lastupdatetime,name,value
    -&gt; FROM timeseries GROUP BY lastupdatetime,name,value;
+----------+---------------------+------+-------+
| timediff | lastupdatetime      | name | value |
+----------+---------------------+------+-------+
| 00:00:10 | 2016-09-09 15:19:44 | x    | 15,2  |
| 00:00:00 | 2016-09-09 15:19:56 | y    | 16,05 |
| 00:00:00 | 2016-09-09 15:19:58 | c    | 16,12 |
| 00:00:00 | 2016-09-09 15:20:12 | x    | 15,98 |
+----------+---------------------+------+-------+
4 rows in set (0.00 sec)

mysql&gt;


GIVE IT A TRY !!!

Please note that you will have to index this table to make the aggregation fast