当我在 psql
中运行这个命令时:
ANALYZE VERBOSE table_name;
我得到这样的输出:
INFO: analyzing "public.table_name"
INFO: "table_name": scanned 4 of 4 pages, containing 426 live rows and 18 dead rows; 426 rows in sample, 426 estimated total rows
ANALYZE
如果我从 PHP 应用程序中运行相同的命令,我可以访问相同的输出吗?
pg_query('ANALYZE VERBOSE table_name;');
最佳答案
exec("psql dbname -c \"analyze verbose table_name\" 2>&1", $output);
2>&1 是必要的,因为前两行被放入 stderr,没有它你将只得到“ANALYZE”。
关于php - PHP 能否获得 pg_query ('ANALYZE VERBOSE table_name;' ) 的详细输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22537624/