性能:PHP 和 MS SQL Server:使用 Exec 或 Driver 的 SQLCMD
我目前正在使用 SQLCMD 对 SQL Server 进行查询,并从 PHP 的 exec() 函数运行它。我希望澄清这并不像 PHP 的 SQL Server 驱动程序那么有效: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx。我不确定这是否与 https://www.php 相同。 net/manual/en/book.mssql.php?
我发现每次运行 exec 命令时,响应速度都相当慢,我希望在转向这个新驱动程序并实现它之前得到确认。使用此驱动程序而不是使用 exec 函数来启动 SQLCMD 是否存在性能差异?
我知道这有点模糊,但我真的很感谢您对这个决定的帮助。
谢谢大家
I am currrently making queries to my SQL Server using SQLCMD and I run this from PHPs exec() function. I was hoping to clarify that this isn't as efficient as the driver for SQL Server for PHP: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx. I am not sure if this is the same as https://www.php.net/manual/en/book.mssql.php?
I find that everytime I run an exec command it is quite a slow response and I was hoping to get this confirmed before I move to this new driver and implement it. Is there a performance difference using this Driver rather than using the exec function to launch SQLCMD?
I know this is a bit fluffy, but I really appreciate help on this decision.
Thanks all
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
呃,是的,摆脱你的 exec 并使用 php 客户端库。您也不必处理从命令行解析结果集的问题。
Ugg, yeah, get rid of your exec and use the php client library. You also won't have to deal with parsing your result sets back off the command line.
使用 exec 或其他程序执行函数之一启动另一个命令,需要时间 ;使用一些 PHP 函数/类可能总是更快 - 更容易:
我肯定会使用 PHP 扩展提供的某些函数,而不是使用 exec。
作为旁注,在这种特定情况下:
sqlsrv_*
函数Launching another command, using exec or one of the other Program execution Functions, takes time ; using some PHP function/classes will probably always be faster -- and easier :
I would definitly go with using some function provided by a PHP extension, instead of using exec.
As a sidenote, in this specific case :
sqlsrv_*
functions