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,17 +1685,22 @@ function modules_get_previous_data ($id_agent_module, $utimestamp = 0, $string =
|
|||||||
$table = 'tagente_datos';
|
$table = 'tagente_datos';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf ('SELECT *
|
$sql = sprintf (
|
||||||
FROM ' . $table . '
|
"SELECT * FROM %s
|
||||||
WHERE id_agente_modulo = %d
|
WHERE id_agente_modulo = %d
|
||||||
AND utimestamp <= %d
|
AND utimestamp = ( SELECT max(utimestamp)
|
||||||
ORDER BY utimestamp DESC',
|
FROM tagente_datos
|
||||||
$id_agent_module, $utimestamp,
|
WHERE id_agente_modulo = %d
|
||||||
$utimestamp - SECONDS_2DAY
|
AND utimestamp <= %d )",
|
||||||
|
$table,
|
||||||
|
$id_agent_module,
|
||||||
|
$id_agent_module,
|
||||||
|
$utimestamp
|
||||||
);
|
);
|
||||||
|
|
||||||
$search_in_history_db = db_search_in_history_db($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