Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
When the server skips the column definitions in the COM_STMT_EXECUTE response (MARIADB_CLIENT_CACHE_METADATA), mthd_stmt_read_execute_response() rebuilds mysql->fields by deep copying stmt->fields. That is six string duplications per column on every execution.
Nothing reads this copy in the common case: it is copied back field by field onto stmt->fields (a no-op) and freed with the next command. So the network saving of metadata caching is partly lost on the client side.
Change
Only make the copy when stmt->fields is going to be rebuilt from mysql->fields (more result sets follow, or stmt->field_count was reset). Otherwise mysql->fields stays NULL and the statement keeps using its own metadata.