Skip to content

feature request : MariaDB pipeline PREPARE + EXECUTE #1689

@rusher

Description

@rusher

this feature request is part of a serie to improve performance when using MariaDB : see doc

MariaDB (since 10.2) permit sending COM_STMT_PREPARE + COM_STMT_EXECUTE directly, without having to wait for prepare, this permit faster first execution. It wpuld be great to have that !

from https://mariadb.com/kb/en/mariadb-protocol-differences-with-mysql/#pipelining-prepare-execute

Connectors usually follow a two-step process for prepared statements:

Prepare: Send a COM_STMT_PREPARE command to the server, receiving a statement ID in response.
Execute: Send a COM_STMT_EXECUTE command, using the statement ID obtained in the previous step.
When the server support MARIADB_CLIENT_STMT_BULK_OPERATIONS capability (since MariaDB 10.2), a specific statement ID value of -1 (or 0xffffffff in hexadecimal) can be used to indicate that the previously prepared statement could be reused. This enables connectors to pipeline the preparation and execution steps into a single request:

Send a COM_STMT_PREPARE then a COM_STMT_EXECUTE with statement ID -1 (0xffffffff) commands to the server.
Read the prepare and execute responses
If the COM_STMT_PREPARE command returns an error (ERR_Packet), the subsequent COM_STMT_EXECUTE with statement ID -1 will also fail and return an error.

By eliminating the round trip for the separate COM_STMT_EXECUTE command, this approach improves performance for the first execution.

Traditionally, connectors send COM_STMT_PREPARE, wait for results, then execute COM_STMT_EXECUTE with statement_id received from the prepare result.

This description has been done for COM_STMT_EXECUTE, but COM_STMT_BULK_EXECUTE works exactly the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions