什么是资源密集型的,fopen+fwrite OR mysql_query()


What is more resource intensive, fopen+fwrite OR mysql_query()

我正在编写一个相当大的脚本,它必须处理大量数据,但是其中有一部分用于日志记录,我想知道,什么使用更少的资源,将文件添加到 txt 文件或 mysql 查询中的行上?我将如何测试它?

$start = microtime(); 
// your process here
$end = microtime();
// Compare duration.