The problem is in the very long execution of php, a JSON object is created in the file only, and it takes 30 seconds for a table of 7000 rows. Tell me what's wrong with the query creation format? I attach screenshots of mysql and JSON output
<?php header("Content-type: text/json"); $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("test", $con); $data = mysql_query("SELECT * FROM sensor") or die ("Connection error"); while($row = mysql_fetch_array($data)) { $temp[]= array((int)strtotime($row['time']) * 1000,(float)$row['value']); $temp1[]= array((int)strtotime($row['time']) * 1000,(float)$row['value1']); $temp2[]= array((int)strtotime($row['time']) * 1000,(int)$row['value2']); $temp0= array($temp,$temp1,$temp2); } echo json_encode($temp0); mysql_close($con); ?> 

$temp0over and over again - perhaps it eats memory and time. The result at the output suits you? - Sergiksjson_encodecan eat a lot of CPU time for large data structures - Dmitriy Simushev