This is the documentation for Vitess v11.0, an older release. See the v24.0 documentation for the latest release.
vtctl Query Command Reference
The following vtctl commands are available for administering queries.
Commands #
VtGateExecute #
Executes the given SQL query with the provided bound variables against the vtgate server.
Example #
VtGateExecute -server <vtgate> [-bind_variables <JSON map>] [-keyspace <default keyspace>] [-tablet_type <tablet type>] [-options <proto text options>] [-json] <sql>
Flags #
| Name | Type | Definition |
|---|---|---|
| json | Boolean | Output JSON instead of human-readable table |
| options | string | execute options values as a text encoded proto of the ExecuteOptions structure |
| server | string | VtGate server to connect to |
| target | string | keyspace:shard@tablet_type |
Arguments #
<vtgate>– Required.<sql>– Required.
Errors #
- the
<sql>argument is required for the<VtGateExecute>command This error occurs if the command is not called with exactly one argument. - query commands are disabled (set the -enable_queries flag to enable)
- error connecting to vtgate '%v': %v
- Execute failed: %v
VtTabletExecute #
Executes the given query on the given tablet. -transaction_id is optional. Use VtTabletBegin to start a transaction.
Example #
VtTabletExecute [-username <TableACL user>] [-transaction_id <transaction_id>] [-options <proto text options>] [-json] <tablet alias> <sql>
Flags #
| Name | Type | Definition |
|---|---|---|
| json | Boolean | Output JSON instead of human-readable table |
| options | string | execute options values as a text encoded proto of the ExecuteOptions structure |
| transaction_id | Int | transaction id to use, if inside a transaction. |
| username | string | If set, value is set as immediate caller id in the request and used by vttablet for TableACL check |
Arguments #
<TableACL user>– Required.<tablet alias>– Required. A Tablet Alias uniquely identifies a vttablet. The argument value is in the format<cell name>-<uid>.<sql>– Required.
Errors #
- the
<tablet_alias>and<sql>arguments are required for the<VtTabletExecute>command This error occurs if the command is not called with exactly 2 arguments. - query commands are disabled (set the -enable_queries flag to enable)
- cannot connect to tablet %v: %v
- Execute failed: %v
VtTabletBegin #
Starts a transaction on the provided server.
Example #
VtTabletBegin [-username <TableACL user>] <tablet alias>
Flags #
| Name | Type | Definition |
|---|---|---|
| username | string | If set, value is set as immediate caller id in the request and used by vttablet for TableACL check |
Arguments #
<TableACL user>– Required.<tablet alias>– Required. A Tablet Alias uniquely identifies a vttablet. The argument value is in the format<cell name>-<uid>.
Errors #
- the
<tablet_alias>argument is required for the<VtTabletBegin>command This error occurs if the command is not called with exactly one argument. - query commands are disabled (set the -enable_queries flag to enable)
- cannot connect to tablet %v: %v
- Begin failed: %v
VtTabletCommit #
Commits the given transaction on the provided server.
Example #
VtTabletCommit [-username <TableACL user>] <transaction_id>
Flags #
| Name | Type | Definition |
|---|---|---|
| username | string | If set, value is set as immediate caller id in the request and used by vttablet for TableACL check |
Arguments #
<TableACL user>– Required.<transaction_id>– Required.
Errors #
- the
<tablet_alias>and<transaction_id>arguments are required for the<VtTabletCommit>command This error occurs if the command is not called with exactly 2 arguments. - query commands are disabled (set the -enable_queries flag to enable)
- cannot connect to tablet %v: %v
VtTabletRollback #
Rollbacks the given transaction on the provided server.
Example #
VtTabletRollback [-username <TableACL user>] <tablet alias> <transaction_id>
Flags #
| Name | Type | Definition |
|---|---|---|
| username | string | If set, value is set as immediate caller id in the request and used by vttablet for TableACL check |
Arguments #
<TableACL user>– Required.<tablet alias>– Required. A Tablet Alias uniquely identifies a vttablet. The argument value is in the format<cell name>-<uid>.<transaction_id>– Required.
Errors #
- the
<tablet_alias>and<transaction_id>arguments are required for the<VtTabletRollback>command This error occurs if the command is not called with exactly 2 arguments. - query commands are disabled (set the -enable_queries flag to enable)
- cannot connect to tablet %v: %v
VtTabletStreamHealth #
Executes the StreamHealth streaming query to a vttablet process. Will stop after getting <count> answers.
Example #
VtTabletStreamHealth [-count <count, default 1>] <tablet alias>
Flags #
| Name | Type | Definition |
|---|---|---|
| count | Int | number of responses to wait for |
Arguments #
<count default 1>– Required.<tablet alias>– Required. A Tablet Alias uniquely identifies a vttablet. The argument value is in the format<cell name>-<uid>.
Errors #
- the
<tablet alias>argument is required for the<VtTabletStreamHealth>command This error occurs if the command is not called with exactly one argument. - query commands are disabled (set the -enable_queries flag to enable)
- cannot connect to tablet %v: %v
See Also #
vtctl Query Command Reference