Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130670 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 131761A00BC for ; Sun, 19 Apr 2026 21:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1776632855; bh=Z6fOSLwN5CEQZCksHjaio5ZjArRmNcwA240CFv+TM44=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZO8eES1vmI74m8BdXNEFEMBt/b6ASGkqCUabOHNml4yXSTuPjT3VR5coQI0RxnN/y Jf57Q84fJFfLhV/9pXmO/8UkDffa6n2MTDKTPmQGy46TYLcRPj6cRqKfv66zzLEwGS K1+uVl4DgT8TnTtosXJELPL0hqn42WrXYylB/RkoYQJEE0tmwWCAHfIVa/oNPUv/Zb 19fgfnUbl/HkuWhZli/8lNKKHZIjtswNPZ1TIVSsPGxmLkWr1krU0GslDu2Dxf6mfQ phD/nIhRm9FFpWDDn04sSjCiwQUCaSmvKGMlh7pPsa02igKrR4iL6EibFFFiAx5L60 mmOIZgTfPXDSw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 420AB180032 for ; Sun, 19 Apr 2026 21:07:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 19 Apr 2026 21:07:33 +0000 (UTC) Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-43fe3e22e33so1532224f8f.0 for ; Sun, 19 Apr 2026 14:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776632847; cv=none; d=google.com; s=arc-20240605; b=QyGSil0oZwGjZaeijFd4I7pWAWFBYEkUXeZv7+TOK7YRPrOC54pzuHH5yzipDWT5nD 52qs2ZY6Y0+Z23BklOPGmPrXccYH3kSlZQVVrbsKSEz9BZSs+5lVb/q19cBTgWMo4+GC qWs80slEfWb4WW5Qu7ri8ui8Kbv7glpn/jXp+6Rb9a/vEv+8gn/wP/oIRbfS/CuR11zc geURAi4uClhDKjqUSsaRGRo0WsysfkdbPrRvntZ/Cm1MIBB9z2Gj93dUnj7nsQlJr9RJ 2kaE+0gkJSMBXJqFOuYuOAe3haH2j4ayfgNrsPeW6Spo51W/Mp0MOYbXiYZCl1RXKSAt py3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=Z6fOSLwN5CEQZCksHjaio5ZjArRmNcwA240CFv+TM44=; fh=gMcHF1JLHb6/07jid222ZnIlRMcYuNFipdxg+WWFfpo=; b=eJopaBKFZqacM/1LrbWWGiDRTQSglc9FavIfSQY+0yD/skZD1FBMqHhhsO53g09YEw B6x1p+QZGcpFO7zjvKJrGLRPkA4dGbfiwnAkl/D95qLM1C0z/ooG8IDZptDt4vi7QZOU UfWlZ/DyEAluOOeRT5t11vyDttPerTvJdAfzUYk+73XZM2GCQYATkq5TWR0G8QDAYiJc 5yov12BOjgyA8wMpGEXIBSlow6wFguM73XRL39tpV/I7U+UIDbNCNYIfT/D8PoCXVH63 bNhFP5rSmEoB1VBQcFowREyuqkPJAE44F4dTrnXG3JBGYAp5fIY93vba3H5SeH/i+Dzc bqSg==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mariadb.com; s=google; t=1776632847; x=1777237647; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Z6fOSLwN5CEQZCksHjaio5ZjArRmNcwA240CFv+TM44=; b=VU0P3ABl+6dBXOj1b4nLgrR1YLKK2+ZRlG2kbe9kw3sUjkLEk0G8KijpPieTNIXVvS md+Tquu4ZUBgvIV08qbOkWvL+eFYb6KK2yRRHQcFGmb2KagYv0vMaEfHQLz8qtEs7Zyi 35nyJ64K+MOfCO2Dbm+b3U4tyPTbmB8ZdcWbc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776632847; x=1777237647; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Z6fOSLwN5CEQZCksHjaio5ZjArRmNcwA240CFv+TM44=; b=WYBe5PJ86cXAwFXppZB5l+7d+roO8Ui+EyKL3PFLBdK4aGGkg1PVOGxoXW7shkL/Om DGpBByHSpFONLNld2hsUjqOebq/YR1xMHpQ+he5YmVXl5ZwTb4pzkAb6aKyX9XGDxWXo 9e0zX57/tu+Ksyi+1MzpM66daGz+ZeYatx6IVz9geYCXaMH3V0q/pUR7YrOFnBnw7n0I ajsQxON0GSkqgbTxJLIzqWjXdVoim8WSpHcreyE6LWOTBOEjPWuMNrMknDfqwmzJL/g0 PKURjz8bncjiZZvFMZqqQ2d385Q0LeUN+xqMiLtCisqcmn7Ec4EGb2mduMndUCpFpcdh bOkw== X-Gm-Message-State: AOJu0YxoVnpeanSj0pZmxdKNHWRmHye5sTYs5cwiMxxTkMzRfrOonHEB WTFMY1/QGJouOqw5hHXUuJ9/eN5LierM39FLKUydLG5uU2MgAF9adv5zRv0Aq4GfrkkMHJ5gOki +7s90BUvdRCryJIaxVMbjgvrVbAUsrUzE8FnS4nzcxpZwqRviEEZd1Q4= X-Gm-Gg: AeBDiet4meiGpL/OTNUFP6eVK1vpDsR8fkpzsYyttyBmjnZEJWKmjRvAC7+2Y5xlS/I y79SCSsVIJ4GqPSe94QDZeFBaYO7xqjosQ3XjeoNuq7VXJRWaQ5RulZ5+92FM+m/uY1r64M1rML 6d8NFgrLOnJtxX0ml+ZgvA0obC6ag6QHBwoaUtgH1CDAL7SjimiTUteLa3AMJ5c8PTKR5Qg/GDW P3SElBV9PC+f2x8AJM5kMgnp00NIXCzGnwZkRDRM/EG/kRiyNeOPfMowCQIItLKcG9gXHG1yqDY ud+oOIffcH434o++hM8G0XQEpecT7mtRFw4C+AKW/vVSQCPM8zDOSAfSZJhG X-Received: by 2002:a05:6000:2212:b0:43d:7868:21e5 with SMTP id ffacd0b85a97d-43fe3dcbee2mr16439431f8f.12.1776632847168; Sun, 19 Apr 2026 14:07:27 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 19 Apr 2026 23:07:15 +0200 X-Gm-Features: AQROBzBLfJbPYPw8_I7MwANkrDDJ2eYp5ckSKGeNuS0-qN0YEY10hTaXMLCxWkc Message-ID: Subject: Re: [PHP-DEV] [RFC][Discussion] Add MariaDB-specific features to mysqlnd and mysqli To: Robert Humphries Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000c0873c064fd69129" From: georg@mariadb.com (Georg Richter) --000000000000c0873c064fd69129 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Robert, When I designed and wrote mysqli (and parts of libmysql 4.1) nearly 25 years ago, the computing landscape was fundamentally different. Memory was a severe constraint; allocating large buffers to send data all at once was often impossible. This necessitated the use of mysql_stmt_send_long_data to stream larger BLOBs in portions=E2=80=94which was a primary reason for requ= iring the explicit types specification in mysqli_stmt::bind_param. Furthermore, CPU power was significantly more limited. The overhead of converting types between the client and server was expensive. By providing explicit type hints (like "isss"), we gave the engine a shortcut, bypassing the need for the driver to "guess" or perform trial-and-error casts, thus saving precious cycles at both ends of the connection. Twenty-five years later, the landscape has evolved. Physical memory is rarely the bottleneck; we are now primarily limited by the max_allowed_packet size. Modern hardware and the maturity of libraries mean that the CPU cost of internal type-juggling is now negligible for the vast majority of applications. However, we must avoid the "sledgehammer" approach of deprecation. In high-speed, high-concurency environments where packet size and execution speed remain fundamental requirements, the ability to explicitly define types is still important. It allows for the most efficient binary serialization possible, which is critical for the "power-user" tier of the PHP ecosystem. /Georg On Sun, Apr 19, 2026 at 3:45=E2=80=AFPM Robert Humphries < contact@developer-rob.co.uk> wrote: > > Despite your convincing arguments for better network utilization by > > providing the types, I still think we should not offer the possibility > > of specifying the types. I don't know what other PHP developers on > > this mailing list think about it, but for me the type feature goes > > against the nature of PHP. Making the parameter optional is very good > > choice and eases my concerns slightly, so if I am outnumbered in my > > opinion, I won't be upset. > > The number of mysqli users grows increasingly smaller. Out of this, > > the number of people who will use execute_many and who will need to > > optimize for TINYINT is unbelievably tiny. Any string easily > > overshadows the numerical data. Thus, this feature won't see much > > legitimate use. > > I think the risk here is that currently the `types` parameter is > supported in existing code (via `bind_param`); and it is not > deprecated / no warnings exist on its usage in the manual. I think > having the parameter in new code be optional was a sensible change; > but until `mysqli_stmt::bind_param` is deprecated or the `types` > parameter is removed there; allowing users to specify the types in new > functions where there is a benefit to doing so (even if only a small > number of people will use the benefit) makes sense to do unless there > are technical or other reasons not to. If setting types for a prepared > statement shouldn't be done in PHP, then where that currently can be > done should be deprecated and in the future removed. > --=20 Georg Richter, Staff Software Engineer Client Connectivity MariaDB Corporation Ab --000000000000c0873c064fd69129 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Robert,

When I designed a= nd wrote mysqli (and parts of libmysql 4.1) nearly 25 years ago, the comput= ing landscape was fundamentally different. Memory was a severe constraint; = allocating large buffers to send data all at once was often impossible. Thi= s necessitated the use of mysql_stmt_send_long_data to stream larger BLOBs = in portions=E2=80=94which was a primary reason for requiring the explicit t= ypes specification in mysqli_stmt::bind_param.

Furthermore, CPU powe= r was significantly more limited. The overhead of converting types between = the client and server was expensive. By providing explicit type hints (like= "isss"), we gave the engine a shortcut, bypassing the need for t= he driver to "guess" or perform trial-and-error casts, thus savin= g precious cycles at both ends of the connection.

Twenty-five years = later, the landscape has evolved. Physical memory is rarely the bottleneck;= we are now primarily limited by the max_allowed_packet size. Modern hardwa= re and the maturity of libraries mean that the CPU cost of internal type-ju= ggling is now negligible for the vast majority of applications.

Howe= ver, we must avoid the "sledgehammer" approach of deprecation. In= high-speed, high-concurency environments where packet size and execution s= peed remain fundamental requirements, the ability to explicitly define type= s is still important. It allows for the most efficient binary serialization= possible, which is critical for the "power-user" tier of the PHP= ecosystem.

/Georg


<= div class=3D"gmail_quote gmail_quote_container">
On Sun, Apr 19, 2026 at 3:45=E2=80=AFPM Robert Humphries <contact@developer-rob.co.uk= > wrote:
>= Despite your convincing arguments for better network utilization by
> providing the types, I still think we should not offer the possibility=
> of specifying the types. I don't know what other PHP developers on=
> this mailing list think about it, but for me the type feature goes
> against the nature of PHP. Making the parameter optional is very good<= br> > choice and eases my concerns slightly, so if I am outnumbered in my > opinion, I won't be upset.
> The number of mysqli users grows increasingly smaller. Out of this, > the number of people who will use execute_many and who will need to > optimize for TINYINT is unbelievably tiny. Any string easily
> overshadows the numerical data. Thus, this feature won't see much<= br> > legitimate use.

I think the risk here is that currently the `types` parameter is
supported in existing code (via `bind_param`); and it is not
deprecated / no warnings exist on its usage in the manual. I think
having the parameter in new code be optional was a sensible change;
but until `mysqli_stmt::bind_param` is deprecated or the `types`
parameter is removed there; allowing users to specify the types in new
functions where there is a benefit to doing so (even if only a small
number of people will use the benefit) makes sense to do unless there
are technical or other reasons not to. If setting types for a prepared
statement shouldn't be done in PHP, then where that currently can be done should be deprecated and in the future removed.


--
Georg Richter, Staff Software Eng= ineer
Client Connectivity
MariaDB Corporation Ab
--000000000000c0873c064fd69129--