OS Manuals

/usr/bin/clickhouse-client

ClickHouse is the fastest and most resource efficient open-source database for real-time apps and analytics.

From clickhouse-26.5 26.5.2.39-r0 (os), captured 2026-11-05 by running clickhouse-client --help (exit 0). permalink

Also provided by 42 other package versions
Usage: clickhouse-client [--query <query>]
clickhouse-client is a client application that is used to connect to ClickHouse.

It can run queries as a command line tool if you pass queries as an argument
or as an interactive client.
Queries can run one at a time, or in a multiquery mode.
To change settings you may use SET statements and SETTINGS clause
in queries or set them for a session with corresponding arguments.
'clickhouse-client' command will try to connect to clickhouse-server running
on the same server. If you have credentials set up, pass them with
--user <username> --password <password> or with --ask-password argument
that will open command prompt.

Connect to tcp native port (9000) without encryption:
    clickhouse-client --host clickhouse.example.com --password mysecretpassword
Connect to secure endpoint:
    clickhouse-client --secure --host clickhouse.example.com --password mysecretpassword

Main options:
  --help            Print usage summary and exit; combine
                    with --verbose to display all options
  --verbose         Increase output verbosity
  -V [ --version ]  Print version and exit
  --version-clean   Print version in machine-readable
                    format and exit
  -C [ --config-file ] arg
                    Path to config file
  --proto_caps arg  Enable/disable chunked protocol:
                    chunked_optional, notchunked,
                    notchunked_optional, send_chunked,
                    send_chunked_optional, send_notchunked,
                    send_notchunked_optional, recv_chunked,
                    recv_chunked_optional, recv_notchunked,
                    recv_notchunked_optional
  -q [ --query ] arg
                    Query. Can be specified multiple times
                    (--query "SELECT 1" --query "SELECT 2")
                    or once with multiple
                    semicolon-separated queries (--query
                    "SELECT 1; SELECT 2;"). In the latter
                    case, INSERT queries with non-VALUE
                    format must be separated by empty
                    lines.
  --queries-file arg
                    File path with queries to execute;
                    multiple files can be specified
                    (--queries-file file1 file2...)
  -n [ --multiquery ]
                    Obsolete, does nothing
  -m [ --multiline ]
                    If specified, allow multi-line queries
                    (Enter does not send the query)
  -d [ --database ] arg
                    Database
  --query_kind arg (=initial_query)
                    One of initial_query/secondary_query/no
                    _query
  --query_id arg    Query ID
  --history_file arg
                    Path to a file containing command
                    history
  --history_max_entries arg (=1000000)
                    Maximum number of entries in the
                    history file
  --stage arg (=complete)
                    Request query processing up to
                    specified stage: complete,fetch_columns
                    ,with_mergeable_state,with_mergeable_st
                    ate_after_aggregation,with_mergeable_st
                    ate_after_aggregation_and_limit
  --progress [=arg(=tty)] (=default)
                    Print progress of queries execution -
                    to TTY: tty|on|1|true|yes; to STDERR
                    non-interactive mode: err; OFF:
                    off|0|false|no; DEFAULT - interactive
                    to TTY, non-interactive is off
  --progress-table [=arg(=tty)] (=default)
                    Print a progress table with changing
                    metrics during query execution - to
                    TTY: tty|on|1|true|yes; to STDERR
                    non-interactive mode: err; OFF:
                    off|0|false|no; DEFAULT - interactive
                    to TTY, non-interactive is off
  --enable-progress-table-toggle arg (=1)
                    Enable toggling of the progress table
                    by pressing the control key (Space).
                    Only applicable in interactive mode
                    with the progress table enabled.
  -A [ --disable_suggestion ]
                    Disable loading suggestions. Note that
                    suggestions are loaded asynchronously
                    through a second connection to
                    ClickHouse server. Recommended when
                    pasting queries with TAB characters.
  --wait_for_suggestions_to_load
                    Load suggestion data synchronously
  --suggestion_limit arg (=10000)
                    Suggestion limit for how many
                    databases, tables and columns to fetch
  -t [ --time ]     Print query execution time to stderr in
                    non-interactive mode (for benchmarks)
  --memory-usage [=arg(=default)] (=none)
                    Print memory usage to stderr in
                    non-interactive mode (for benchmarks).
                    Values: 'none', 'default', 'readable'
  --echo            In batch mode, print query before
                    execution
  --log-level arg   Log level
  --server_logs_file arg
                    Write server logs to specified file
  -f [ --format ] arg
                    Default input and output format. In
                    clickhouse-client only the default
                    output format.
  --output-format arg
                    Default output format. Takes precedence
                    over --format.
  -E [ --vertical ]
                    Same as --format=Vertical or FORMAT
                    Vertical or \G at end of command
  --highlight arg (=1)
                    Toggle syntax highlighting in
                    interactive mode (can also use
                    --hilite)
  --ignore-error    Do not stop processing after an error
                    occurred
  --stacktrace      Print stack traces of exceptions
  --hardware-utilization
                    Print hardware utilization information
                    in progress bar
  --print-profile-events
                    Printing ProfileEvents packets
  --profile-events-delay-ms arg (=0)
                    Delay between printing `ProfileEvents`
                    packets (-1 - print only totals, 0 -
                    print every single packet)
  --processed-rows  Print the number of locally processed
                    rows
  --interactive     Process queries-file or --query query
                    and start interactive mode
  --pager arg       Pipe all output into this command (less
                    or similar)
  --prompt arg      Custom prompt string
  --max_memory_usage_in_client arg
                    Set memory limit in client/local server
  --client_logs_file arg
                    Path to a file for writing client logs.
                    Currently we only have fatal logs (when
                    the client crashes)
  -c [ --config ] arg
                    config-file path (another shorthand)
  --connection arg  connection to use (from the client
                    config), by default connection name is
                    hostname
  -s [ --secure ]   Use TLS connection
  --tls-sni-override arg
                    Override the SNI host name used for TLS
                    connections
  --no-secure       Don't use TLS connection
  -u [ --user ] arg (=default)
                    user
  --password arg    password
  --ask-password    ask-password
  --ssh-key-file arg
                    File containing the SSH private key for
                    authenticate with the server.
  --ssh-key-passphrase arg
                    Passphrase for the SSH private key
                    specified by --ssh-key-file.
  --quota_key arg   A string to differentiate quotas when
                    the user have keyed quotas configured
                    on server
  --jwt arg         Use JWT for authentication
  --one-time-password arg
                    Time-based one-time password (TOTP) for
                    two-factor authentication
  --login           Use OAuth 2.0 to login
  --oauth-url arg   The base URL for the OAuth 2.0
                    authorization server
  --oauth-client-id arg
                    The client ID for the OAuth 2.0
                    application
  --oauth-audience arg
                    The audience for the OAuth 2.0 token
  --max_client_network_bandwidth arg
                    the maximum speed of data exchange over
                    the network for the client in bytes per
                    second.
  --compression arg enable or disable compression (enabled
                    by default for remote communication and
                    disabled for localhost communication).
  --query-fuzzer-runs arg (=0)
                    After executing every SELECT query, do
                    random mutations in it and run again
                    specified number of times. This is used
                    for testing to discover unexpected
                    corner cases.
  --create-query-fuzzer-runs arg (=0)
  --buzz-house-config arg
                    Path to configuration file for
                    BuzzHouse
  --interleave-queries-file arg
                    file path with queries to execute
                    before every file from 'queries-file';
                    multiple files can be specified
                    (--queries-file file1 file2...); this
                    is needed to enable more aggressive
                    fuzzing of newly added tests (see
                    'query-fuzzer-runs' option)
  --opentelemetry-traceparent arg
                    OpenTelemetry traceparent header as
                    described by W3C Trace Context
                    recommendation
  --opentelemetry-tracestate arg
                    OpenTelemetry tracestate header as
                    described by W3C Trace Context
                    recommendation
  --no-warnings     disable warnings when client connects
                    to server
  --no-server-client-version-message
                    suppress server-client version mismatch
                    message
  --fake-drop       Ignore all DROP queries, should be used
                    only for testing
  --accept-invalid-certificate
                    Ignore certificate verification errors,
                    equal to config parameters
                    openSSL.client.invalidCertificateHandle
                    r.name=AcceptCertificateHandler and
                    openSSL.client.verificationMode=none
  --inline-insert-data
                    Send INSERT data as is in the query
                    text instead of converting it to blocks
                    in the native format. The server will
                    parse the inline data itself, avoiding
                    the round-trip to receive table
                    structure.

External tables options:
  --external        marks the beginning of a clause. You
                    may have multiple sections like this,
                    for the number of tables being
                    transmitted
  --file arg        data file or - for stdin
  --name arg (=_data)
                    name of the table
  --format arg (=TabSeparated)
                    data format
  --structure arg   structure
  --types arg       types

Hosts and ports options:
  -h [ --host ] arg (=localhost)
                    Server hostname. Multiple hosts can be
                    passed via multiple argumentsExample of
                    usage: '--host host1 --host host2
                    --port port2 --host host3 ...'Each
                    '--port port' will be attached to the
                    last seen host that doesn't have a port
                    yet,if there is no such host, the port
                    will be attached to the next first host
                    or to default host.
  --port arg        server ports

All settings are documented at https://clickhouse.com/docs/operations/settings/settings.
Note: if clickhouse is installed, you can use 'clickhouse-client' invocation with a dash.

Example printing current longest running query on a server:
    clickhouse-client --query \
        'SELECT * FROM system.processes ORDER BY elapsed LIMIT 1 FORMAT Vertical'
Example creating table and inserting data:
    clickhouse-client --multiquery --query \
        'CREATE TABLE t (a Int) ENGINE = Memory; INSERT INTO t VALUES (1), (2), (3)'

In addition, --param_name=value can be specified for substitution of parameters for parameterized queries.

See also: https://clickhouse.com/docs/en/integrations/sql-clients/cli
Options (54)
OptionDescriptionSource
--helpPrint usage summary and exit;help
--verboseIncrease output verbosityhelp
-VPrint version and exithelp
--version-cleanPrint version in machine-readable format and exithelp
--proto_caps argEnable/disable chunked protocol: chunked_optional, notchunked, notchunked_optional, send_chunked, send_chunked_optional, send_notchunked, send_notchunked_optional, recv_chunked,…help
--queries-file argFile path with queries to execute;help
--query_id argQuery IDhelp
--history_file argPath to a file containing command historyhelp
--wait_for_suggestions_to_loadLoad suggestion data synchronouslyhelp
-tPrint query execution time to stderr in non-interactive mode (for benchmarks)help
--echoIn batch mode, print query before executionhelp
--log-level argLog levelhelp
--server_logs_file argWrite server logs to specified filehelp
--output-format argDefault output format.help
--ignore-errorDo not stop processing after an error occurredhelp
--stacktracePrint stack traces of exceptionshelp
--hardware-utilizationPrint hardware utilization information in progress barhelp
--print-profile-eventsPrinting ProfileEvents packetshelp
--processed-rowsPrint the number of locally processed rowshelp
--interactiveProcess queries-file or --query query and start interactive modehelp
--pager argPipe all output into this command (less or similar)help
--prompt argCustom prompt stringhelp
--max_memory_usage_in_client argSet memory limit in client/local serverhelp
--client_logs_file argPath to a file for writing client logs.help
--connection argconnection to use (from the client config), by default connection name is hostnamehelp
-sUse TLS connectionhelp
--tls-sni-override argOverride the SNI host name used for TLS connectionshelp
--no-secureDon't use TLS connectionhelp
--password argpasswordhelp
--ask-passwordask-passwordhelp
--ssh-key-file argFile containing the SSH private key for authenticate with the server.help
--ssh-key-passphrase argPassphrase for the SSH private key specified by --ssh-key-file.help
--quota_key argA string to differentiate quotas when the user have keyed quotas configured on serverhelp
--jwt argUse JWT for authenticationhelp
--one-time-password argTime-based one-time password (TOTP) for two-factor authenticationhelp
--loginUse OAuth 2.0 to loginhelp
--oauth-url argThe base URL for the OAuth 2.0 authorization serverhelp
--oauth-client-id argThe client ID for the OAuth 2.0 applicationhelp
--oauth-audience argThe audience for the OAuth 2.0 tokenhelp
--max_client_network_bandwidth argthe maximum speed of data exchange over the network for the client in bytes per second.help
--buzz-house-config argPath to configuration file for BuzzHousehelp
--interleave-queries-file argfile path with queries to execute before every file from 'queries-file';help
--opentelemetry-traceparent argOpenTelemetry traceparent header as described by W3C Trace Context recommendationhelp
--opentelemetry-tracestate argOpenTelemetry tracestate header as described by W3C Trace Context recommendationhelp
--no-warningsdisable warnings when client connects to serverhelp
--no-server-client-version-messagesuppress server-client version mismatch messagehelp
--fake-dropIgnore all DROP queries, should be used only for testinghelp
--accept-invalid-certificateIgnore certificate verification errors, equal to config parameters openSSL.client.invalidCertificateHandle r.name=AcceptCertificateHandler and openSSL.client.verificationMode=nonehelp
--inline-insert-dataSend INSERT data as is in the query text instead of converting it to blocks in the native format.help
--externalmarks the beginning of a clause.help
--file argdata file or - for stdinhelp
--structure argstructurehelp
--types argtypeshelp
--port argserver portshelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.