|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81564 Extreme ODBC performance degradation after Windows PHP 7.3 to 7.4 upgrade
Submitted: 2021-10-28 23:00 UTC Modified: 2021-11-14 04:22 UTC
From: ckieffer at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: ODBC related
PHP Version: 7.4.25 OS: Windows Server 2019
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-10-28 23:00 UTC] ckieffer at gmail dot com
Have a batch processing PHP script that runs thousands of individual odbc_exec() SELECTS and INSERTS against a SQL Server 2019 database. After upgrade from PHP 7.3 to 7.4 the process runs 7x slower (20 minutes before upgrade, 180 minutes after). This process maps lots of relatively small database records (no big nvarchar fields, etc).

I haven't found any similar problem/bug reports. The process does complete eventually, so I understand that this isn't necessarily a bug. I may have to rewrite to use PDO or migrate to a DB stored procedure but I'd like to understand the cause. 

Environment and Testing Notes

System: Windows NT 10.0 build 17763 (Windows Server 2016) AMD64
Configure: cscript /nologo /e:jscript configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--without-analyzer" "--with-pgo"

- All 64-bit software and drivers.
- Upgraded precompiled PHP 7.3.32 (TS VC15) for Windows to 7.4.25. Also tried PHP 8.0 which is just as slow.
- Windows Server 2019 web and SQL Servers (no change during upgrade).
- Stock PHP ODBC extension config (no change during upgrade).
- Recent MS ODBC driver for SQL Server. Tried updating to latest available (17.8.11).

Expected result:
This script completes in about 25 minutes under PHP 7.2.x and 7.3.x. 

Actual result:
After upgrade to PHP 7.4.24, the script takes over 3 hours to complete.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-02 12:18 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-11-02 12:18 UTC]
> I may have to rewrite to use PDO or migrate to a DB stored
> procedure but I'd like to understand the cause.

Me too!  Maybe you can try with some PHP 7.4.x from the archives[1]
to narrow down the exact version where the performance regression
has been introduced?

Anyhow, you should consider to use sqlsrv[2] or pdo_sqlsrv[3]
instead of the general ODBC or PDO_ODBC extensions when dealing
with SQLServer.

[1] <>
[2] <>
[3] <>
 [2021-11-02 23:26 UTC] ckieffer at gmail dot com
It's good to know that I'm not alone and I appreciate the response!

I doubt that I'll have time (or energy) to do regression testing, but who knows.

I am planning to move to PDO or SqlSrv extensions.
 [2021-11-14 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Sep 26 05:01:25 2023 UTC