mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge branch '2463-Graficas_cargan_muy_lentas_en_la_primera_muestra' into 'develop'
mejora el rendimiento en consulta sql See merge request artica/pandorafms!1605
This commit is contained in:
commit
3c31d0216e
@ -1685,17 +1685,22 @@ function modules_get_previous_data ($id_agent_module, $utimestamp = 0, $string =
|
||||
$table = 'tagente_datos';
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM ' . $table . '
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp <= %d
|
||||
ORDER BY utimestamp DESC',
|
||||
$id_agent_module, $utimestamp,
|
||||
$utimestamp - SECONDS_2DAY
|
||||
$sql = sprintf (
|
||||
"SELECT * FROM %s
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp = ( SELECT max(utimestamp)
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp <= %d )",
|
||||
$table,
|
||||
$id_agent_module,
|
||||
$id_agent_module,
|
||||
$utimestamp
|
||||
);
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($utimestamp);
|
||||
return db_get_row_sql ($sql, $search_in_history_db);
|
||||
|
||||
return db_get_row_sql($sql, $search_in_history_db);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user