mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
mejora el rendimiento en consulta sql
This commit is contained in:
parent
49ed21b93d
commit
69852a1c2a
@ -1685,16 +1685,21 @@ function modules_get_previous_data ($id_agent_module, $utimestamp = 0, $string =
|
||||
$table = 'tagente_datos';
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM ' . $table . '
|
||||
$sql = sprintf (
|
||||
"SELECT * FROM %s
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp <= %d
|
||||
ORDER BY utimestamp DESC',
|
||||
$id_agent_module, $utimestamp,
|
||||
$utimestamp - SECONDS_2DAY
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user