是否可以用字节来测量数据集?
我正在搜索相同的内容,因为我需要计算我对快速基表进行某些调试过程的搜索字节数。
数据集可以像操作一样简单
从员工中选择 *
它获取 1000 多行,每行 5 列
是否可以在PHP应用程序中计算出来?
我在谷歌上搜索这个不是很成功。
有什么建议吗?
谢谢。
strlen() 返回消耗的字节数,因此您应该能够使用如下内容:
<?php
// example of what you might get back from a SQL SELECT
$data = array (
array (1, 'foo', 'bar'),
array (2, 'baz', 'biz'),
);
// tally up the byte count for every scalar in the set
$bytes = 0;
array_walk_recursive($data, function ($item) use (&$bytes) {
$bytes += strlen((string)$item);
});
echo $bytes . "'n";
?>