dongpao5261 2012-08-06 09:50
浏览 93
已采纳

PHP - 为什么新的SQLSRV驱动程序比旧的mssql驱动程序慢?

I've a lot of components using the old driver mssql from PHP. I want to switch to the new driver SQLSRV by Microsoft but my queries are a lot of slower.

I've many processes handling +400 000 rows.

Here are my tests with 40 000 rows :

  • testOldDriver_mssql = Rows 40000 : 1 seconds
  • testNewDriver_nonPDO = Rows 40000 : 7 seconds
  • testNewDriver_PDO = Rows 40000 : 4 seconds

Here my biggest proccess (+480 000 rows) :

  • testOldDriver_mssql = Rows 484856 : 27 seconds
  • testNewDriver_nonPDO = Rows 484856 : 120 seconds
  • testNewDriver_PDO = Rows 484856 : 47 seconds
  • testPDO_ODBC = Rows 484856 : 24 seconds

Is the new driver definitely slower ? Or am I'm missing something ?

Edit 1:

By "old driver" I mean the deprecated MSSQL library (see php.net/mssql).

The new driver is the one made directly by Microsoft (see http://www.microsoft.com/en-us/download/details.aspx?id=20098)

My query is

SELECT * FROM myTable 
WHERE pdvSaisie IN 
       (SELECT number FROM pdvs WHERE nom LIKE 'ZUEE %') 

and using a direct query() (no prepare and same result if I use a prepared statement).

Edit 2:

Added PDO/ODBC test. Surprise, it's faster :o

  • 写回答

3条回答 默认 最新

查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思