OS Manuals

/usr/bin/chl

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

From clickhouse-24.4 24.4.4.113-r4 (enterprise-packages), captured 2026-11-08 by running chl --help (exit 0). permalink

usage: clickhouse-local [initial table definition] [--query <query>]
clickhouse-local allows to execute SQL queries on your data files via single command line call. To do so, initially you need to define your data source and its format. After you can execute your SQL queries in usual manner.
There are two ways to define initial table keeping your data. Either just in first query like this:
    CREATE TABLE <table> (<structure>) ENGINE = File(<input-format>, <file>);
Either through corresponding command line parameters --table --structure --input-format and --file.
Main options:
  --help            print usage summary, combine with
                    --verbose to display all options
  --verbose         print query and other debugging info
  -V [ --version ]  print version information and exit
  --version-clean   print version in machine-readable
                    format and exit
  -C [ --config-file ] arg
                    config-file path
  -q [ --query ] arg
                    query; can be specified multiple times
                    (--query "SELECT 1" --query "SELECT
                    2"...)
  --queries-file arg
                    file path with queries to execute;
                    multiple files can be specified
                    (--queries-file file1 file2...)
  -n [ --multiquery ]
                    If specified, multiple queries
                    separated by semicolons can be listed
                    after --query. For convenience, it is
                    also possible to omit --query and pass
                    the queries directly after
                    --multiquery.
  -m [ --multiline ]
                    If specified, allow multiline queries
                    (do not send the query on Enter)
  -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 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
  -A [ --disable_suggestion ]
                    Disable loading suggestion data. Note
                    that suggestion data is loaded
                    asynchronously through a second
                    connection to ClickHouse server. Also
                    it is reasonable to disable suggestion
                    if you want to paste a query with TAB
                    characters. Shorthand option -A is for
                    those who get used to mysql client.
  --wait_for_suggestions_to_load
                    Load suggestion data synchonously.
  -t [ --time ]     print query execution time to stderr in
                    non-interactive mode (for benchmarks)
  --echo            in batch mode, print query before
                    execution
  --log-level arg   log level
  --server_logs_file arg
                    put server logs into specified file
  --suggestion_limit arg (=10000)
                    Suggestion limit for how many
                    databases, tables and columns to fetch.
  -f [ --format ] arg
                    default output format (and input format
                    for clickhouse-local)
  --output-format arg
                    default output format (this option has
                    preference over --format)
  -E [ --vertical ]
                    vertical output format, same as
                    --format=Vertical or FORMAT Vertical or
                    \G at end of command
  --highlight arg (=1)
                    enable or disable basic syntax
                    highlight in interactive command line
  --ignore-error    do not stop processing in multiquery
                    mode
  --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)
  --max_memory_usage_in_client arg
                    Set memory limit in client/local server
  --fuzzer-args arg Command line arguments for the LLVM's
                    libFuzzer driver. Only relevant if the
                    application is compiled with libFuzzer.
  -N [ --table ] arg
                    name of the initial table
  -S [ --structure ] arg
                    structure of the initial table (list of
                    column and type names)
  -F [ --file ] arg path to file with data of the initial
                    table (stdin if not specified)
  --input-format arg
                    input format of the initial table data
  --logger.console [=arg(=1)]
                    Log to console
  --logger.log arg  Log file name
  --logger.level arg
                    Log level
  --no-system-tables
                    do not attach system tables (better
                    startup time)
  --path arg        Storage path
  --only-system-tables
                    attach only system tables from
                    specified path
  --top_level_domains_path arg
                    Path to lists with custom TLDs

Example printing memory used by each Unix user:
ps aux | tail -n +2 | awk '{ printf("%s\t%s\n", $1, $4) }' | clickhouse-local -S "user String, mem Float64" -q "SELECT user, round(sum(mem), 2) as mem_total FROM table GROUP BY user ORDER BY mem_total DESC FORMAT PrettyCompact"
In addition, --param_name=value can be specified for substitution of parameters for parametrized queries.

See also: https://clickhouse.com/docs/en/operations/utilities/clickhouse-local/
Options (29)
OptionDescriptionSource
--helpprint usage summary, combine withhelp
--verboseprint query and other debugging infohelp
-Vprint version information and exithelp
--version-cleanprint version in machine-readable format and exithelp
--queries-file argfile path with queries to execute;help
--query_id argquery_idhelp
--history_file argpath to history filehelp
--wait_for_suggestions_to_loadLoad suggestion data synchonously.help
-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 argput server logs into specified filehelp
--output-format argdefault output format (this option has preference over --format)help
--ignore-errordo not stop processing in multiquery modehelp
--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
--max_memory_usage_in_client argSet memory limit in client/local serverhelp
--input-format arginput format of the initial table datahelp
--logger.console arg(=1)Log to consolehelp
--logger.log argLog file namehelp
--logger.level argLog levelhelp
--no-system-tablesdo not attach system tables (better startup time)help
--path argStorage pathhelp
--only-system-tablesattach only system tables from specified pathhelp
--top_level_domains_path argPath to lists with custom TLDshelp

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