Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The function documentation below is generated from the
system.functions system table.FQDN
Introduced in: v20.1.0 Returns the fully qualified domain name of the ClickHouse server. SyntaxfullHostName
Arguments
- None.
String
Examples
Usage example
Query
Response
MACNumToString
Introduced in: v1.1.0 Interprets aUInt64 number as a MAC address in big endian format.
Returns the corresponding MAC address in format AA:BB:CC:DD:EE:FF (colon-separated numbers in hexadecimal form) as string.
Syntax
num— UInt64 number.UInt64
String
Examples
Usage example
Query
Response
MACStringToNum
Introduced in: v1.1.0 The inverse function of MACNumToString. If the MAC address has an invalid format, it returns 0. Syntaxs— MAC address string.String
UInt64
Examples
Usage example
Query
Response
MACStringToOUI
Introduced in: v1.1.0 Given a MAC address in format AA:BB:CC:DD:EE:FF (colon-separated numbers in hexadecimal form), returns the first three octets as a UInt64 number. If the MAC address has an invalid format, it returns 0. Syntaxs— MAC address string.String
UInt64
Examples
Usage example
Query
Response
authenticatedUser
Introduced in: v25.11.0 If the session user has been switched using the EXECUTE AS command, this function returns the name of the original user that was used for authentication and creating the session. Alias: authUser() SyntaxauthUser
Arguments
- None.
String
Examples
Usage example
Query
Response
bar
Introduced in: v1.1.0 Builds a bar chart. Draws a band with width proportional to (x - min) and equal to width characters when x = max. The band is drawn with accuracy to one eighth of a symbol. Syntaxx— Size to display.(U)Int*orFloat*orDecimalmin— The minimum value.(U)Int*orFloat*orDecimalmax— The maximum value.(U)Int*orFloat*orDecimalwidth— Optional. The width of the bar in characters. The default is80.const (U)Int*orconst Float*orconst Decimal
String
Examples
Usage example
Query
Response
blockNumber
Introduced in: v1.1.0 Returns a monotonically increasing sequence number of the block containing the row. The returned block number is updated on a best-effort basis, i.e. it may not be fully accurate. Syntax- None.
UInt64
Examples
Basic usage
Query
Response
blockSerializedSize
Introduced in: v20.3.0 Returns the uncompressed size in bytes of a block of values on disk. Syntaxx1[, x2, ...]— Any number of values for which to get the uncompressed size of the block.Any
UInt64
Examples
Usage example
Query
Response
blockSize
Introduced in: v1.1.0 In ClickHouse, queries are processed in blocks (chunks). This function returns the size (row count) of the block the function is called on. Syntax- None.
UInt64
Examples
Usage example
Query
Response
buildId
Introduced in: v20.5.0 Returns the build ID generated by a compiler for the running ClickHouse server binary. If executed in the context of a distributed table, this function generates a normal column with values relevant to each shard. Otherwise it produces a constant value. Syntax- None.
String
Examples
Usage example
Query
Response
byteSize
Introduced in: v21.1.0 Returns an estimation of the uncompressed byte size of its arguments in memory. ForString arguments, the function returns the string length + 8 (length).
If the function has multiple arguments, the function accumulates their byte sizes.
Syntax
arg1[, arg2, ...]— Values of any data type for which to estimate the uncompressed byte size.Any
UInt64
Examples
Usage example
Query
Response
Query
Response
catboostEvaluate
Introduced in: v22.9.0 Evaluate an external catboost model. CatBoost is an open-source gradient boosting library developed by Yandex for machine learning. Accepts a path to a catboost model and model arguments (features). Prerequisites- Build the catboost evaluation library
libcatboostmodel.<so|dylib> library must be made available. See CatBoost documentation how to compile it.
Next, specify the path to libcatboostmodel.<so|dylib> in the clickhouse configuration:
catboostEvaluate(), the server starts the library bridge process if it is not running already. Both processes
communicate using a HTTP interface. By default, port 9012 is used. A different port can be specified as follows - this is useful if port
9012 is already assigned to a different service.
- Train a catboost model using libcatboost
path_to_model— Path to catboost model.const Stringfeature— One or more model features/arguments.Float*
Float64
Examples
catboostEvaluate
Query
Response
colorOKLABToSRGB
Introduced in: v26.2.0 Converts a color from the OKLab perceptual color space to the sRGB color space. The input color is specified in the OKLab color space. If the input values are outside the typical OKLab ranges, the result is implementation-defined. OKLab uses three components:- L: perceptual lightness (typically in the range [0..1])
- a: green-red opponent axis
- b: blue-yellow opponent axis
- Conversion from OKLab to linear sRGB.
- Conversion from linear sRGB to gamma-encoded sRGB.
tuple— A tuple of three numeric valuesL,a,b, whereLis in the range[0...1].Tuple(Float64, Float64, Float64)gamma— Optional. The exponent that is used to transform linear sRGB back to sRGB by applying(x ^ (1 / gamma)) * 255for each channelx. Defaults to2.2.Float64
Tuple(Float64, Float64, Float64)
Examples
Convert OKLAB to sRGB (Float)
Query
Response
Query
Response
colorOKLCHToSRGB
Introduced in: v25.7.0 Converts a colour from the OKLCH perceptual colour space to the familiar sRGB colour space. IfL is outside the range [0...1], C is negative, or H is outside the range [0...360], the result is implementation-defined.
OKLCH is a cylindrical version of the OKLab colour space.
It’s three coordinates are
L (the lightness in the range [0...1]), C (chroma >= 0) and H (hue in degrees from [0...360]).
OKLab/OKLCH is designed to be perceptually uniform while remaining cheap to compute.colorSRGBToOKLCH:
- OKLCH to OKLab.
- OKLab to Linear sRGB
- Linear sRGB to sRGB
tuple— A tuple of three numeric valuesL,C,H, whereLis in the range[0...1],C >= 0andHis in the range[0...360].Tuple(Float64, Float64, Float64)gamma— Optional. The exponent that is used to transform linear sRGB back to sRGB by applying(x ^ (1 / gamma)) * 255for each channelx. Defaults to2.2.Float64
Tuple(Float64, Float64, Float64)
Examples
Convert OKLCH to sRGB
Query
Response
Query
Response
colorSRGBToOKLAB
Introduced in: v26.2.0 Converts a colour encoded in the sRGB colour space to the perceptually uniform OKLAB colour space. If any input channel is outside[0...255] or the gamma value is non-positive, the behaviour is implementation-defined.
OKLAB is a perceptually uniform color space.
Its three coordinates are
L (the lightness in the range [0...1]), a (Green-Red axis) and b (Blue-Yellow axis).
OKLab is designed to be perceptually uniform while remaining cheap to compute.- sRGB to Linear sRGB
- Linear sRGB to OKLab
tuple— Tuple of three values R, G, B in the range[0...255].Tuple(UInt8, UInt8, UInt8)gamma— Optional. Exponent that is used to linearize sRGB by applying(x / 255)^gammato each channelx. Defaults to2.2.Float64
Tuple(Float64, Float64, Float64)
Examples
Convert sRGB to OKLAB
Query
Response
colorSRGBToOKLCH
Introduced in: v25.7.0 Converts a colour encoded in the sRGB colour space to the perceptually uniform OKLCH colour space. If any input channel is outside[0...255] or the gamma value is non-positive, the behaviour is implementation-defined.
OKLCH is a cylindrical version of the OKLab colour space.
It’s three coordinates are
L (the lightness in the range [0...1]), C (chroma >= 0) and H (the hue in degrees from [0...360]).
OKLab/OKLCH is designed to be perceptually uniform while remaining cheap to compute.- sRGB to Linear sRGB
- Linear sRGB to OKLab
- OKLab to OKLCH.
tuple— Tuple of three values R, G, B in the range[0...255].Tuple(UInt8, UInt8, UInt8)gamma— Optional. Exponent that is used to linearize sRGB by applying(x / 255)^gammato each channelx. Defaults to2.2.Float64
Tuple(Float64, Float64, Float64)
Examples
Convert sRGB to OKLCH
Query
Response
connectionId
Introduced in: v21.3.0 Returns the connection ID of the client that submitted the current query. This function is most useful in debugging scenarios. It was created for compatibility with MySQL’sCONNECTION_ID function.
It is not typically used in production queries.
Syntax
- None.
UInt64
Examples
Usage example
Query
Response
countDigits
Introduced in: v20.8.0 Returns the number of decimal digits needed to represent a value.This function takes into account the scales of decimal values i.e., it calculates the result over the underlying integer type which is
(value * scale).For example:countDigits(42) = 2countDigits(42.000) = 5countDigits(0.04200) = 4
x. UInt8
Examples
Usage example
Query
Response
currentDatabase
Introduced in: v1.1.0 Returns the name of the current database. Useful in table engine parameters ofCREATE TABLE queries where you need to specify the database.
Also see the SET statement.
Syntax
current_database, SCHEMA, DATABASE
Arguments
- None.
String
Examples
Usage example
Query
Response
Query
Response
currentProfiles
Introduced in: v21.9.0 Returns an array of the setting profiles for the current user. Syntax- None.
Array(String)
Examples
Usage example
Query
Response
currentQueryID
Introduced in: v25.2.0 Returns current Query id. Syntaxcurrent_query_id
Arguments
- None.
Query
Response
currentRoles
Introduced in: v21.9.0 Returns an array of the roles which are assigned to the current user. Syntax- None.
Array(String)
Examples
Usage example
Query
Response
currentSchemas
Introduced in: v23.7.0 Same as functioncurrentDatabase but
- accepts a boolean argument which is ignored
- returns the database name as an array with a single value.
currentSchemas only exists for compatibility with PostgreSQL.
Please use currentDatabase instead.
Also see the SET statement.
Syntax
current_schemas
Arguments
bool— A boolean value, which is ignored.Bool
Array(String)
Examples
Usage example
Query
Response
currentUser
Introduced in: v20.1.0 Returns the name of the current user. In case of a distributed query, the name of the user who initiated the query is returned. Syntaxcurrent_user, user
Arguments
- None.
String
Examples
Usage example
Query
Response
Query
Response
defaultProfiles
Introduced in: v21.9.0 Returns an array of default setting profile names for the current user. Syntax- None.
Array(String)
Examples
Usage example
Query
Response
defaultRoles
Introduced in: v21.9.0 Returns an array of default roles for the current user. Syntax- None.
Array(String)
Examples
Usage example
Query
Response
defaultValueOfArgumentType
Introduced in: v1.1.0 Returns the default value for a given data type. Does not include default values for custom columns set by the user. Syntaxexpression— Arbitrary type of value or an expression that results in a value of an arbitrary type.Any
0 for numbers, an empty string for strings or NULL for Nullable types. UInt8 or String or NULL
Examples
Usage example
Query
Response
Query
Response
defaultValueOfTypeName
Introduced in: v1.1.0 Returns the default value for the given type name. Syntaxtype— A string representing a type name.String
0 for numbers, an empty string for strings, or NULL for Nullable UInt8 or String or NULL
Examples
Usage example
Query
Response
Query
Response
displayName
Introduced in: v22.11.0 Returns the value ofdisplay_name from config or the server’s Fully Qualified Domain Name (FQDN) if not set.
Syntax
- None.
display_name from config or server FQDN if not set. String
Examples
Usage example
Query
Response
dumpColumnStructure
Introduced in: v1.1.0 Outputs a detailed description of the internal structure of a column and its data type. Syntaxx— Value for which to get the description of.Any
String
Examples
Usage example
Query
Response
enabledProfiles
Introduced in: v21.9.0 Returns an array of setting profile names which are enabled for the current user. Syntax- None.
Array(String)
Examples
Usage example
Query
Response
enabledRoles
Introduced in: v21.9.0 Returns an array of the roles which are enabled for the current user. Syntax- None.
Array(String)
Examples
Usage example
Query
Response
errorCodeToName
Introduced in: v20.12.0 Returns the textual name of a numeric ClickHouse error code. The mapping from numeric error codes to error names is available here. Syntaxerror_code. String
Examples
Usage example
Query
Response
file
Introduced in: v21.3.0 Reads a file as a string and loads the data into the specified column. The file content is not interpreted. Also see thefile table function.
Syntax
path— The path of the file relative to theuser_files_path. Supports wildcards*,**,?,{abc,def}and{N..M}whereN,Mare numbers and'abc', 'def'are strings.Stringdefault— The value returned if the file does not exist or cannot be accessed.StringorNULL
String
Examples
Insert files into a table
Query
Response
filesystemAvailable
Introduced in: v20.1.0 Returns the amount of free space in the filesystem hosting the database persistence. The returned value is always smaller than the total free space (filesystemUnreserved) because some space is reserved for the operating system.
Syntax
disk_name— Optional. The disk name to find the amount of free space for. If omitted, uses the default disk.StringorFixedString
UInt64
Examples
Usage example
Query
Response
filesystemCapacity
Introduced in: v20.1.0 Returns the capacity of the filesystem in bytes. Needs the path to the data directory to be configured. Syntaxdisk_name— Optional. The disk name to get the capacity for. If omitted, uses the default disk.StringorFixedString
UInt64
Examples
Usage example
Query
Response
filesystemUnreserved
Introduced in: v22.12.0 Returns the total amount of free space on the filesystem hosting the database persistence (previouslyfilesystemFree).
See also filesystemAvailable.
Syntax
disk_name— Optional. The disk name for which to find the total amount of free space. If omitted, uses the default disk.StringorFixedString
UInt64
Examples
Usage example
Query
Response
finalizeAggregation
Introduced in: v1.1.0 Given an aggregation state, this function returns the result of aggregation (or the finalized state when using a -State combinator). Syntaxstate— State of aggregation.AggregateFunction
Any
Examples
Usage example
Query
Response
Query
Response
flipCoordinates
Introduced in: v25.11.0 Flips the x and y coordinates of geometric objects. This operation swaps latitude and longitude, which is useful for converting between different coordinate systems or correcting coordinate order. For a Point, it swaps the x and y coordinates. For complex geometries (LineString, Polygon, MultiPolygon, Ring, MultiLineString), it recursively applies the transformation to each coordinate pair. The function supports both individual geometry types (Point, Ring, Polygon, MultiPolygon, LineString, MultiLineString) and the Geometry variant type. Syntaxgeometry— The geometry to transform. Supported types: Point (Tuple(Float64, Float64)), Ring (Array(Point)), Polygon (Array(Ring)), MultiPolygon (Array(Polygon)), LineString (Array(Point)), MultiLineString (Array(LineString)), or Geometry (a variant containing any of these types).
Point or Ring or Polygon or MultiPolygon or LineString or MultiLineString or Geometry
Examples
basic_point
Query
Response
Query
Response
Query
Response
Query
Response
Query
Response
formatQuery
Introduced in: v23.10.0 Returns a formatted, possibly multi-line, version of the given SQL query. Throws in case of a parsing error. [example:multiline] Syntaxquery— The SQL query to be formatted. String
String
Examples
multiline
Query
Response
formatQueryOrNull
Introduced in: v23.11.0 Returns a formatted, possibly multi-line, version of the given SQL query. Returns NULL in case of a parsing error. [example:multiline] Syntaxquery— The SQL query to be formatted. String
String
Examples
multiline
Query
Response
formatQuerySingleLine
Introduced in: v23.10.0 Like formatQuery() but the returned formatted string contains no line breaks. Throws in case of a parsing error. [example:multiline] Syntaxquery— The SQL query to be formatted. String
String
Examples
multiline
Query
Response
formatQuerySingleLineOrNull
Introduced in: v23.11.0 Like formatQuery() but the returned formatted string contains no line breaks. Returns NULL in case of a parsing error. [example:multiline] Syntaxquery— The SQL query to be formatted.String
String
Examples
multiline
Query
Response
formatReadableDecimalSize
Introduced in: v22.11.0 Given a size (number of bytes), this function returns a readable, rounded size with suffix (KB, MB, etc.) as a string. The opposite operations of this function areparseReadableSize.
Syntax
x— Size in bytes.UInt64
String
Examples
Format file sizes
Query
Response
formatReadableQuantity
Introduced in: v20.10.0 Given a number, this function returns a rounded number with suffix (thousand, million, billion, etc.) as a string. This function accepts any numeric type as input, but internally it casts them toFloat64.
Results might be suboptimal with large values.
Syntax
x— A number to format.UInt64
String
Examples
Format numbers with suffixes
Query
Response
formatReadableSize
Introduced in: v1.1.0 Given a size (number of bytes), this function returns a readable, rounded size with suffix (KiB, MiB, etc.) as string. The opposite operations of this function areparseReadableSize, parseReadableSizeOrZero, and parseReadableSizeOrNull.
This function accepts any numeric type as input, but internally it casts them to Float64. Results might be suboptimal with large values.
Syntax
FORMAT_BYTES
Arguments
x— Size in bytes.UInt64
String
Examples
Format file sizes
Query
Response
formatReadableTimeDelta
Introduced in: v20.12.0 Given a time interval (delta) in seconds, this function returns a time delta with year/month/day/hour/minute/second/millisecond/microsecond/nanosecond as a string. This function accepts any numeric type as input, but internally it casts them toFloat64. Results might be suboptimal with large values.
Syntax
column— A column with a numeric time delta.Float64maximum_unit— Optional. Maximum unit to show. Acceptable values:nanoseconds,microseconds,milliseconds,seconds,minutes,hours,days,months,years. Default value:years.const Stringminimum_unit— Optional. Minimum unit to show. All smaller units are truncated. Acceptable values:nanoseconds,microseconds,milliseconds,seconds,minutes,hours,days,months,years. If explicitly specified value is bigger thanmaximum_unit, an exception will be thrown. Default value:secondsifmaximum_unitissecondsor bigger,nanosecondsotherwise.const String
String
Examples
Usage example
Query
Response
Query
Response
fuzzQuery
Introduced in: v26.2.0 Parses the given query string and applies random AST mutations (fuzzing) to it. Returns the fuzzed query as a string. Non-deterministic: each call may produce a different result. Requiresallow_fuzz_query_functions = 1.
Syntax
query— The SQL query to be fuzzed. String
String
Examples
basic
Query
Response
generateRandomStructure
Introduced in: v23.5.0 Generates random table structure in the formatcolumn1_name column1_type, column2_name column2_type, ....
Syntax
number_of_columns— The desired number of columns in the resultant table structure. If set to 0 orNull, the number of columns will be random from 1 to 128. Default value:Null.UInt64seed— Random seed to produce stable results. If seed is not specified or set toNull, it is randomly generated.UInt64
String
Examples
Usage example
Query
Response
Query
Response
Query
Response
generateSerialID
Introduced in: v25.1.0 Generates and returns sequential numbers starting from the previous counter value. This function takes a string argument - a series identifier, and an optional starting value. The server should be configured with Keeper. The series are stored in Keeper nodes under the path, which can be configured inseries_keeper_path in the server configuration.
Syntax
series_identifier— Series identifierconst Stringstart_value— Optional. Starting value for the counter. Defaults to 0. Note: this value is only used when creating a new series and is ignored if the series already existsUInt*
UInt64
Examples
first call
Query
Response
Query
Response
Query
Response
Query
Response
Query
Response
getClientHTTPHeader
Introduced in: v24.5.0 Gets the value of an HTTP header. If there is no such header or the current request is not performed via the HTTP interface, the function returns an empty string. Certain HTTP headers (e.g.,Authentication and X-ClickHouse-*) are restricted.
Setting
allow_get_client_http_header is requiredThe function requires the setting allow_get_client_http_header to be enabled.
The setting is not enabled by default for security reasons, because some headers, such as Cookie, could contain sensitive info.name— The HTTP header name.String
String
Examples
Usage example
Query
Response
getMacro
Introduced in: v20.1.0 Returns the value of a macro from the server configuration file. Macros are defined in the<macros> section of the configuration file and can be used to distinguish servers by convenient names even if they have complicated hostnames.
If the function is executed in the context of a distributed table, it generates a normal column with values relevant to each shard.
Syntax
name— The name of the macro to retrieve.const String
String
Examples
Basic usage
Query
Response
getMaxTableNameLengthForDatabase
Introduced in: v25.1.0 Returns the maximum table name length in a specified database. Syntaxdatabase_name— The name of the specified database.String
Query
Response
getMergeTreeSetting
Introduced in: v25.6.0 Returns the current value of a MergeTree setting. Syntaxsetting_name— The setting name.String
Query
Response
getOSKernelVersion
Introduced in: v21.11.0 Returns a string with the OS kernel version. Syntax- None.
String
Examples
Usage example
Query
Response
getServerPort
Introduced in: v21.10.0 Returns the server’s port number for a given protocol. Syntaxport_name— The name of the port.String
UInt16
Examples
Usage example
Query
Response
getServerSetting
Introduced in: v25.6.0 Returns the currently set value, given a server setting name. Syntaxsetting_name— The server setting name.String
Any
Examples
Usage example
Query
Response
getSetting
Introduced in: v20.7.0 Returns the current value of a setting. Syntaxsetting_Name— The setting name.const String
Any
Examples
Usage example
Query
Response
getSettingOrDefault
Introduced in: v24.10.0 Returns the current value of a setting or returns the default value specified in the second argument if the setting is not set in the current profile. Syntaxsetting_name— The setting name.Stringdefault_value— Value to return if custom_setting is not set. Value may be of any data type or Null.
default_value if the setting is not set.
Examples
Usage example
Query
Response
getSizeOfEnumType
Introduced in: v1.1.0 Returns the number of fields in the givenEnum.
Syntax
x— Value of typeEnum.Enum
Enum input values. UInt8/16
Examples
Usage example
Query
Response
getSubcolumn
Introduced in: v23.3.0 Receives the expression or identifier and constant string with the name of subcolumn. Returns requested subcolumn extracted from the expression. Syntax- None.
Query
Response
getTypeSerializationStreams
Introduced in: v22.6.0 Enumerates stream paths of a data type. This function is intended for developmental use. Syntaxcol— Column or string representation of a data-type from which the data type will be detected.Any
Array(String)
Examples
tuple
Query
Response
Query
Response
globalVariable
Introduced in: v20.5.0 Takes a constant string argument and returns the value of the global variable with that name. This function is intended for compatibility with MySQL and not needed or useful for normal operation of ClickHouse. Only few dummy global variables are defined. Syntaxname— Global variable name.String
name. Any
Examples
globalVariable
Query
Response
hasColumnInTable
Introduced in: v1.1.0 Checks if a specific column exists in a database table. For elements in a nested data structure, the function checks for the existence of a column. For the nested data structure itself, the function returns0.
Syntax
database— Name of the database.const Stringtable— Name of the table.const Stringcolumn— Name of the column.const Stringhostname— Optional. Remote server name to perform the check on.const Stringusername— Optional. Username for remote server.const Stringpassword— Optional. Password for remote server.const String
1 if the given column exists, 0 otherwise. UInt8
Examples
Check an existing column
Query
Response
Query
Response
hasThreadFuzzer
Introduced in: v20.6.0 Returns whether the thread fuzzer is enabled. THis function is only useful for testing and debugging. Syntax- None.
UInt8
Examples
Check Thread Fuzzer status
Query
Response
highlightQuery
Introduced in: v26.5.0 Parses a ClickHouse SQL query string and returns an array of highlighted ranges for syntax highlighting. Each range is a named tuple with the beginning position (in bytes), the end position, and the highlight type. The highlight types describe the syntactic role of the fragment (keyword, identifier, function, etc.) and can be used to assign colors in a UI. Inside LIKE and REGEXP string patterns, metacharacters and escape characters are highlighted separately. Syntaxquery— A ClickHouse SQL query string. String.
(begin UInt64, end UInt64, type Enum8(...)) representing highlighted ranges. Array(Tuple(begin UInt64, end UInt64, type Enum8(...)))
Examples
simple
Query
Response
hostName
Introduced in: v20.5.0 Returns the name of the host on which this function was executed. If the function executes on a remote server (distributed processing), the remote server name is returned. If the function executes in the context of a distributed table, it generates a normal column with values relevant to each shard. Otherwise it produces a constant value. Syntaxhostname
Arguments
- None.
String
Examples
Usage example
Query
Response
icebergBucket
Introduced in: v25.5.0 Implements logic for the iceberg bucket transform SyntaxN— The number of buckets, modulo.const (U)Int*value— The source value to transform.(U)Int*orBoolorDecimalorFloat*orStringorFixedStringorUUIDorDateorTimeorDateTime
Int32
Examples
Example
Query
Response
icebergTruncate
Introduced in: v25.3.0 Implements logic of iceberg truncate transform: https://iceberg.apache.org/spec/#truncate-transform-details. SyntaxQuery
Response
identity
Introduced in: v1.1.0 This function returns the argument you pass to it, which is useful for debugging and testing. It lets you bypass index usage to see full scan performance instead. The query analyzer ignores anything inside identity functions when looking for indexes to use, and it also disables constant folding. Syntaxx— Input value.Any
Any
Examples
Usage example
Query
Response
ignore
Introduced in: v1.1.0 Accepts arbitrary arguments and unconditionally returns0.
Syntax
x— An input value which is unused and passed only so as to avoid a syntax error.Any
0. UInt8
Examples
Usage example
Query
Response
indexHint
Introduced in: v1.1.0 This function is intended for debugging and introspection. It ignores its argument and always returns 1. The arguments are not evaluated. During index analysis, the argument of this function is assumed to not be wrapped inindexHint.
This allows you to select data in index ranges by the corresponding condition but without further filtering by this condition.
The index in ClickHouse is sparse and using indexHint will yield more data than specifying the same condition directly.
Explanation
Explanation
When you run:ClickHouse does two things:ClickHouse does only one thing:
- Uses the index to find which granules (blocks of ~8192 rows) might contain
key = 123 - Reads those granules and filters them row-by-row to return only rows where
key = 123
indexHint, when you run:- Uses the index to find which granules might contain key = 123 and returns all rows from those granules without filtering.
key = 456, key = 789, etc. (Everything that happened to be stored in the same granule.)
indexHint() is not for performance. It’s for debugging and understanding how ClickHouse’s index works:- Which granules does my condition select?
- How many rows are in those granules?
- Is my index being used effectively?
indexHint function. The indexHint function does not optimize the query, as it does not provide any additional information for the query analysis. Having an expression inside the indexHint function is not anyhow better than without the indexHint function. The indexHint function can be used only for introspection and debugging purposes and it does not improve performance. If you see the usage of indexHint by anyone other than ClickHouse contributors, it is likely a mistake and you should remove it.
Syntax
expression— Any expression for index range selection.Expression
1 in all cases. UInt8
Examples
Usage example with date filtering
Query
Response
initialQueryID
Introduced in: v1.1.0 Returns the ID of the initial current query. Other parameters of a query can be extracted from fieldinitial_query_id in system.query_log.
In contrast to queryID function, initialQueryID returns the same results on different shards.
Syntax
initial_query_id
Arguments
- None.
String
Examples
Usage example
Query
Response
initialQueryStartTime
Introduced in: v25.4.0 Returns the start time of the initial current query.initialQueryStartTime returns the same results on different shards.
Syntax
initial_query_start_time
Arguments
- None.
DateTime
Examples
Usage example
Query
Response
initializeAggregation
Introduced in: v20.6.0 Calculates the result of an aggregate function based on a single value. This function can be used to initialize aggregate functions with combinator -State. You can create states of aggregate functions and insert them to columns of typeAggregateFunction or use initialized aggregates as default values.
Syntax
aggregate_function— Name of the aggregation function to initialize.Stringarg1[, arg2, ...]— Arguments of the aggregate function.Any
initializeAggregation takes as a first argument. Any
Examples
Basic usage with uniqState
Query
Response
Query
Response
isConstant
Introduced in: v20.3.0 Returns whether the argument is a constant expression. A constant expression is an expression whose result is known during query analysis, i.e. before execution. For example, expressions over literals are constant expressions. This function is mostly intended for development, debugging and demonstration. Syntaxx— An expression to check.Any
1 if x is constant, 0 if x is non-constant. UInt8
Examples
Constant expression
Query
Response
Query
Response
Query
Response
Query
Response
isDecimalOverflow
Introduced in: v20.8.0 Checks if a decimal number has too many digits to fit properly in a Decimal data type with given precision. Syntaxvalue— Decimal value to check.Decimalprecision— Optional. The precision of the Decimal type. If omitted, the initial precision of the first argument is used.UInt8
1 if the decimal value has more digits than allowed by its precision, 0 if the decimal value satisfies the specified precision. UInt8
Examples
Usage example
Query
Response
joinGet
Introduced in: v18.16.0 Allows you to extract data from a table the same way as from a dictionary. Gets data from Join tables using the specified join key.Only supports tables created with the
ENGINE = Join(ANY, LEFT, <join_keys>) statement.join_storage_table_name— An identifier which indicates where to perform the search. The identifier is searched in the default database (see parameterdefault_databasein the config file). To override the default database, use theUSE database_namequery or specify the database and the table through a dot, likedatabase_name.table_name.Stringvalue_column— The name of the column of the table that contains required data.const Stringjoin_keys— A list of join keys.Any
Any
Examples
Usage example
Query
Response
Query
Response
Query
Response
joinGetOrNull
Introduced in: v20.4.0 Allows you to extract data from a table the same way as from a dictionary. Gets data from Join tables using the specified join key. UnlikejoinGet it returns NULL when the key is missing.
Only supports tables created with the
ENGINE = Join(ANY, LEFT, <join_keys>) statement.join_storage_table_name— An identifier which indicates where to perform the search. The identifier is searched in the default database (see parameter default_database in the config file). To override the default database, use theUSE database_namequery or specify the database and the table through a dot, likedatabase_name.table_name.Stringvalue_column— The name of the column of the table that contains required data.const Stringjoin_keys— A list of join keys.Any
NULL if a key is not found. Any
Examples
Usage example
Query
Response
lowCardinalityIndices
Introduced in: v18.12.0 Returns the position of a value in the dictionary of a LowCardinality column. Positions start at 1. Since LowCardinality have per-part dictionaries, this function may return different positions for the same value in different parts. Syntaxcol— A low cardinality column.LowCardinality
UInt64
Examples
Usage examples
Query
Response
lowCardinalityKeys
Introduced in: v18.12.0 Returns the dictionary values of a LowCardinality column. If the block is smaller or larger than the dictionary size, the result will be truncated or extended with default values. Since LowCardinality have per-part dictionaries, this function may return different dictionary values in different parts. Syntaxcol— A low cardinality column.LowCardinality
UInt64
Examples
lowCardinalityKeys
Query
Response
materialize
Introduced in: v1.1.0 Turns a constant into a full column containing a single value. Full columns and constants are represented differently in memory. Functions usually execute different code for normal and constant arguments, although the result should typically be the same. This function can be used to debug this behavior. Syntaxx— A constant.Any
Any
Examples
Usage example
Query
Response
minSampleSizeContinuous
Introduced in: v23.10.0 Calculates the minimum required sample size for an A/B test comparing means of a continuous metric in two samples. Uses the formula described in this article. Assumes equal sizes of treatment and control groups. Returns the required sample size for one group (i.e. the sample size required for the whole experiment is twice the returned value). Also assumes equal variance of the test metric in treatment and control groups. SyntaxminSampleSizeContinous
Arguments
baseline— Baseline value of a metric.(U)Int*orFloat*sigma— Baseline standard deviation of a metric.(U)Int*orFloat*mde— Minimum detectable effect (MDE) as percentage of the baseline value (e.g. for a baseline value 112.25 the MDE 0.03 means an expected change to 112.25 ± 112.25*0.03).(U)Int*orFloat*power— Required statistical power of a test (1 - probability of Type II error).(U)Int*orFloat*alpha— Required significance level of a test (probability of Type I error).(U)Int*orFloat*
minimum_sample_size, detect_range_lower and detect_range_upper. These are respectively: the required sample size, the lower bound of the range of values not detectable with the returned required sample size, calculated as baseline * (1 - mde), and the upper bound of the range of values not detectable with the returned required sample size, calculated as baseline * (1 + mde) (Float64). Tuple(Float64, Float64, Float64)
Examples
minSampleSizeContinuous
Query
Response
minSampleSizeConversion
Introduced in: v22.6.0 Calculates minimum required sample size for an A/B test comparing conversions (proportions) in two samples. Uses the formula described in this article. Assumes equal sizes of treatment and control groups. Returns the sample size required for one group (i.e. the sample size required for the whole experiment is twice the returned value). Syntaxbaseline— Baseline conversion.Float*mde— Minimum detectable effect (MDE) as percentage points (e.g. for a baseline conversion 0.25 the MDE 0.03 means an expected change to 0.25 ± 0.03).Float*power— Required statistical power of a test (1 - probability of Type II error).Float*alpha— Required significance level of a test (probability of Type I error).Float*
minimum_sample_size, detect_range_lower, detect_range_upper. These are, respectively: the required sample size, the lower bound of the range of values not detectable with the returned required sample size, calculated as baseline - mde, the upper bound of the range of values not detectable with the returned required sample size, calculated as baseline + mde. Tuple(Float64, Float64, Float64)
Examples
minSampleSizeConversion
Query
Response
neighbor
Introduced in: v20.1.0 Returns a value from a column at a specified offset from the current row. This function is deprecated and error-prone because it operates on the physical order of data blocks which may not correspond to the logical order expected by users. Consider using proper window functions instead. The function can be enabled by settingallow_deprecated_error_prone_window_functions = 1.
Syntax
column— The source column.Anyoffset— The offset from the current row. Positive values look forward, negative values look backward.Integerdefault_value— Optional. The value to return if the offset goes beyond the data bounds. If not specified, uses the default value for the column type.Any
Any
Examples
Usage example
Query
Response
Query
Response
normalizeQuery
Introduced in: v20.8.0 Replaces literals, sequences of literals and complex aliases (containing whitespace, more than two digits or at least 36 bytes long such as UUIDs) with placeholder?.
Syntax
x— Sequence of characters.String
String
Examples
Usage example
Query
Response
normalizeQueryKeepNames
Introduced in: v21.2.0 Replaces literals and sequences of literals with placeholder? but does not replace complex aliases (containing whitespace, more than two digits or at least 36 bytes long such as UUIDs).
This helps better analyze complex query logs.
Syntax
x— Sequence of characters.String
String
Examples
Usage example
Query
Response
normalizedQueryHash
Introduced in: v20.8.0 Returns identical 64 bit hash values without the values of literals for similar queries. Can be helpful in analyzing query logs. Syntaxx— Sequence of characters.String
UInt64
Examples
Usage example
Query
Response
normalizedQueryHashKeepNames
Introduced in: v21.2.0 LikenormalizedQueryHash it returns identical 64 bit hash values without the values of literals for similar queries, but it does not replace complex aliases (containing whitespace, more than two digits or at least 36 bytes long such as UUIDs) with a placeholder before hashing.
Can be helpful in analyzing query logs.
Syntax
x— Sequence of characters.String
UInt64
Examples
Usage example
Query
Response
obfuscateQuery
Introduced in: v26.4.0 Obfuscates a SQL query by replacing identifiers with random words and literals with random values while preserving query structure. This function is useful for anonymizing queries before logging or sharing them for debugging purposes. Different rows will produce different obfuscated results even for the same input query, which helps maintain privacy when working with multiple queries. The optionaltag parameter prevents common subexpression elimination when the same function call
is used multiple times in a query. This ensures that each invocation produces a different obfuscated result.
Features:
- Replaces table names, column names, and aliases with random words
- Replaces numeric and string literals with random values
- Preserves the overall query structure and SQL syntax
- Produces different results for different rows
query— The SQL query to obfuscate.Stringtag— Optional. A value to prevent common subexpression elimination when the same function call is used multiple times.
String
Examples
Basic usage
Query
Response
Query
Response
Query
Response
obfuscateQueryWithSeed
Introduced in: v26.4.0 Obfuscates a SQL query using a specified seed for deterministic results. UnlikeobfuscateQuery(), this function produces deterministic results when given the same seed.
This is useful when you need consistent obfuscation across multiple runs or when you want to
reproduce the same obfuscated query for testing or debugging purposes.
Features:
- Deterministic obfuscation based on the provided seed
- Same seed always produces the same obfuscated result
- Different seeds produce different results
- Preserves query structure like obfuscateQuery()
- Reproducible test cases
- Consistent anonymization across multiple runs
- Debugging with consistent obfuscated queries
query— The SQL query to obfuscate.Stringseed— The seed for obfuscation. The same seed produces deterministic results.IntegerorString
String
Examples
Deterministic obfuscation with integer seed
Query
Response
Query
Response
Query
Response
parseReadableSize
Introduced in: v24.6.0 Given a string containing a byte size andB, KiB, KB, MiB, MB, etc. as a unit (i.e. ISO/IEC 80000-13 or decimal byte unit), this function returns the corresponding number of bytes.
If the function is unable to parse the input value, it throws an exception.
The inverse operations of this function are formatReadableSize and formatReadableDecimalSize.
Syntax
x— Readable size with ISO/IEC 80000-13 or decimal byte unit.String
UInt64
Examples
Usage example
Query
Response
parseReadableSizeOrNull
Introduced in: v24.6.0 Given a string containing a byte size andB, KiB, KB, MiB, MB, etc. as a unit (i.e. ISO/IEC 80000-13 or decimal byte unit), this function returns the corresponding number of bytes.
If the function is unable to parse the input value, it returns NULL.
The inverse operations of this function are formatReadableSize and formatReadableDecimalSize.
Syntax
x— Readable size with ISO/IEC 80000-13 or decimal byte unit.String
NULL if unable to parse the input Nullable(UInt64)
Examples
Usage example
Query
Response
parseReadableSizeOrZero
Introduced in: v24.6.0 Given a string containing a byte size andB, KiB, KB, MiB, MB, etc. as a unit (i.e. ISO/IEC 80000-13 or decimal byte unit), this function returns the corresponding number of bytes.
If the function is unable to parse the input value, it returns 0.
The inverse operations of this function are formatReadableSize and formatReadableDecimalSize.
Syntax
x— Readable size with ISO/IEC 80000-13 or decimal byte unit.String
0 if unable to parse the input. UInt64
Examples
Usage example
Query
Response
parseTimeDelta
Introduced in: v22.7.0 Parse a sequence of numbers followed by something resembling a time unit. The time delta string uses these time unit specifications:years,year,yr,ymonths,month,moweeks,week,wdays,day,dhours,hour,hr,hminutes,minute,min,mseconds,second,sec,smilliseconds,millisecond,millisec,msmicroseconds,microsecond,microsec,μs,µs,usnanoseconds,nanosecond,nanosec,ns
;, -, +, ,, :).
The length of years and months are approximations: year is 365 days, month is 30.5 days.
Syntax
timestr— A sequence of numbers followed by something resembling a time unit.String
Float64
Examples
Usage example
Query
Response
Query
Response
partitionId
Introduced in: v21.4.0 Computes the partition ID.This function is slow and should not be called for large numbers of rows.
partitionID
Arguments
column1, column2, ...— Column for which to return the partition ID.
String
Examples
Usage example
Query
Response
queryID
Introduced in: v21.9.0 Returns the ID of the current query. Other parameters of a query can be extracted from fieldquery_id in the system.query_log table.
In contrast to initialQueryID function, queryID can return different results on different shards.
Syntax
query_id
Arguments
- None.
String
Examples
Usage example
Query
Response
revision
Introduced in: v22.7.0 Returns the current ClickHouse server revision. Syntax- None.
UInt32
Examples
Usage example
Query
Response
rowNumberInAllBlocks
Introduced in: v1.1.0 Returns a unique row number for each row processed. Syntax- None.
0. UInt64
Examples
Usage example
Query
Response
rowNumberInBlock
Introduced in: v1.1.0 For each block processed byrowNumberInBlock, returns the number of the current row.
The returned number starts from 0 for each block.
Syntax
- None.
0. UInt64
Examples
Usage example
Query
Response
runningAccumulate
Introduced in: v1.1.0 Accumulates the states of an aggregate function for each row of a data block. Syntaxagg_state— State of the aggregate function.AggregateFunctiongrouping— Optional. Grouping key. The state of the function is reset if thegroupingvalue is changed. It can be any of the supported data types for which the equality operator is defined.Any
Any
Examples
Usage example with initializeAggregation
Query
Response
runningConcurrency
Introduced in: v21.3.0 Calculates the number of concurrent events. Each event has a start time and an end time. The start time is included in the event, while the end time is excluded. Columns with a start time and an end time must be of the same data type. The function calculates the total number of active (concurrent) events for each event start time. Syntaxstart— A column with the start time of events.DateorDateTimeorDateTime64end— A column with the end time of events.DateorDateTimeorDateTime64
UInt32
Examples
Usage example
Query
Response
runningDifference
Introduced in: v1.1.0 Calculates the difference between two consecutive row values in the data block. Returns0 for the first row, and for subsequent rows the difference to the previous row.
The result of the function depends on the affected data blocks and the order of data in the block.
The order of rows during calculation of runningDifference() can differ from the order of rows returned to the user.
To prevent that you can create a subquery with ORDER BY and call the function from outside the subquery.
Please note that the block size affects the result.
The internal state of runningDifference state is reset for each new block.
Syntax
x— Column for which to calculate the running difference.Any
Query
Response
Query
Response
runningDifferenceStartingWithFirstValue
Introduced in: v1.1.0 Calculates the difference between consecutive row values in a data block, but unlikerunningDifference, it returns the actual value of the first row instead of 0.
Syntax
x— Column for which to calculate the running difference.Any
Any
Examples
Usage example
Query
Response
serverUUID
Introduced in: v20.1.0 Returns the random and unique UUID (v4) generated when the server is first started. The UUID is persisted, i.e. the second, third, etc. server start return the same UUID. Syntax- None.
UUID
Examples
Usage example
Query
Response
shardCount
Introduced in: v21.9.0 Returns the total number of shards for a distributed query. If a query is not distributed then constant value0 is returned.
Syntax
- None.
0. UInt32
Examples
Usage example
Query
Response
shardNum
Introduced in: v21.9.0 Returns the index of a shard which processes a part of data in a distributed query. Indices begin from1.
If a query is not distributed then a constant value 0 is returned.
Syntax
- None.
0. UInt32
Examples
Usage example
Query
Response
showCertificate
Introduced in: v22.6.0 Shows information about the current server’s Secure Sockets Layer (SSL) certificate if it has been configured. See Configuring TLS for more information on how to configure ClickHouse to use OpenSSL certificates to validate connections. Syntax- None.
Map(String, String)
Examples
Usage example
Query
Response
sleep
Introduced in: v1.1.0 Pauses the execution of a query by the specified number of seconds. The function is primarily used for testing and debugging purposes. Thesleep() function should generally not be used in production environments, as it can negatively impact query performance and system responsiveness.
However, it can be useful in the following scenarios:
- Testing: When testing or benchmarking ClickHouse, you may want to simulate delays or introduce pauses to observe how the system behaves under certain conditions.
- Debugging: If you need to examine the state of the system or the execution of a query at a specific point in time, you can use
sleep()to introduce a pause, allowing you to inspect or collect relevant information. - Simulation: In some cases, you may want to simulate real-world scenarios where delays or pauses occur, such as network latency or external system dependencies.
allow_sleep enabled).
Syntax
seconds— The number of seconds to pause the query execution to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.const UInt*orconst Float*
0. UInt8
Examples
Usage example
Query
Response
sleepEachRow
Introduced in: v1.1.0 Pauses the execution of a query for a specified number of seconds for each row in the result set. ThesleepEachRow() function is primarily used for testing and debugging purposes, similar to the sleep() function.
It allows you to simulate delays or introduce pauses in the processing of each row, which can be useful in scenarios such as:
- Testing: When testing or benchmarking ClickHouse’s performance under specific conditions, you can use
sleepEachRow()to simulate delays or introduce pauses for each row processed. - Debugging: If you need to examine the state of the system or the execution of a query for each row processed, you can use
sleepEachRow()to introduce pauses, allowing you to inspect or collect relevant information. - Simulation: In some cases, you may want to simulate real-world scenarios where delays or pauses occur for each row processed, such as when dealing with external systems or network latencies.
seconds— The number of seconds to pause the query execution for each row in the result set to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.const UInt*orconst Float*
0 for each row. UInt8
Examples
Usage example
Query
Response
structureToCapnProtoSchema
Introduced in: v23.8.0 Function that converts ClickHouse table structure to CapnProto format schema Syntax- None.
Query
Response
structureToProtobufSchema
Introduced in: v23.8.0 Converts a ClickHouse table structure to Protobuf format schema. This function takes a ClickHouse table structure definition and converts it into a Protocol Buffers (Protobuf) schema definition in proto3 syntax. This is useful for generating Protobuf schemas that match your ClickHouse table structures for data interchange. Syntaxstructure— ClickHouse table structure definition as a string (e.g., ‘column1 Type1, column2 Type2’).Stringmessage_name— Name for the Protobuf message type in the generated schema.String
String
Examples
Converting ClickHouse structure to Protobuf schema
Query
Response
tcpPort
Introduced in: v20.12.0 Returns the native interface TCP port number listened to by the server. If executed in the context of a distributed table, this function generates a normal column with values relevant to each shard. Otherwise it produces a constant value. Syntax- None.
UInt16
Examples
Usage example
Query
Response
throwIf
Introduced in: v1.1.0 Throw an exception if argument x is true. To use theerror_code argument, configuration parameter allow_custom_error_code_in_throw must be enabled.
Syntax
x— The condition to check.Anymessage— Optional. Custom error message.const Stringerror_code— Optional. Custom error code.const Int8/16/32
0 if the condition is false, throws an exception if the condition is true. UInt8
Examples
Usage example
Query
Response
toColumnTypeName
Introduced in: v1.1.0 Returns the internal name of the data type of the given value. Unlike functiontoTypeName, the returned data type potentially includes internal wrapper columns like Const and LowCardinality.
Syntax
value— Value for which to return the internal data type.Any
String
Examples
Usage example
Query
Response
toTypeName
Introduced in: v1.1.0 Returns the type name of the passed argument. IfNULL is passed, the function returns type Nullable(Nothing), which corresponds to ClickHouse’s internal NULL representation.
Syntax
x— A value of arbitrary type.Any
String
Examples
Usage example
Query
Response
tokenizeQuery
Introduced in: v26.5.0 Tokenizes a ClickHouse SQL query string and returns an array of tokens. Each token is a named tuple with the beginning position (in bytes), the end position, and the token type. Syntaxquery— A ClickHouse SQL query string. String.
(begin UInt64, end UInt64, type Enum8(...)) representing the tokens of the query. Array(Tuple(begin UInt64, end UInt64, type Enum8(...)))
Examples
simple
Query
Response
transactionID
Introduced in: v22.6.0 Returns the ID of a transaction.This function is part of an experimental feature set.
Enable experimental transaction support by adding this setting to your configuration:For more information see the page Transactional (ACID) support.
- None.
start_csn, local_tid and host_id.
start_csn: Global sequential number, the newest commit timestamp that was seen when this transaction began.local_tid: Local sequential number that is unique for each transaction started by this host within a specific start_csn.host_id: UUID of the host that has started this transaction.Tuple(UInt64, UInt64, UUID)
Query
Response
transactionLatestSnapshot
Introduced in: v22.6.0 Returns the newest snapshot (Commit Sequence Number) of a transaction that is available for reading.This function is part of an experimental feature set. Enable experimental transaction support by adding this setting to your configuration:For more information see the page Transactional (ACID) support.
- None.
UInt64
Examples
Usage example
Query
Response
transactionOldestSnapshot
Introduced in: v22.6.0 Returns the oldest snapshot (Commit Sequence Number) that is visible for some running transaction.This function is part of an experimental feature set. Enable experimental transaction support by adding this setting to your configuration:For more information see the page Transactional (ACID) support.
- None.
UInt64
Examples
Usage example
Query
Response
transform
Introduced in: v1.1.0 Transforms a value according to the explicitly defined mapping of some elements to other elements. There are two variations of this function:transform(x, array_from, array_to, default)- transformsxusing mapping arrays with a default value for unmatched elementstransform(x, array_from, array_to)- same transformation but returns the originalxif no match is found
x in array_from and returns the corresponding element from array_to at the same index.
If x is not found in array_from, it returns either the default value (4-parameter version) or the original x (3-parameter version).
If multiple matching elements exist in array_from, it returns the element corresponding to the first match.
Requirements:
array_fromandarray_tomust have the same number of elements- For 4-parameter version:
transform(T, Array(T), Array(U), U) -> UwhereTandUcan be different compatible types - For 3-parameter version:
transform(T, Array(T), Array(T)) -> Twhere all types must be the same
x— Value to transform.(U)Int*orDecimalorFloat*orStringorDateorDateTimearray_from— Constant array of values to search for matches.Array((U)Int*)orArray(Decimal)orArray(Float*)orArray(String)orArray(Date)orArray(DateTime)array_to— Constant array of values to return for corresponding matches inarray_from.Array((U)Int*)orArray(Decimal)orArray(Float*)orArray(String)orArray(Date)orArray(DateTime)default— Optional. Value to return ifxis not found inarray_from. If omitted, returns x unchanged.(U)Int*orDecimalorFloat*orStringorDateorDateTime
array_to if x matches an element in array_from, otherwise returns default (if provided) or x (if default not provided). Any
Examples
transform(T, Array(T), Array(U), U) -> U
Query
Response
Query
Response
uniqThetaIntersect
Introduced in: v22.9.0 Two uniqThetaSketch objects to do intersect calculation(set operation ∩), the result is a new uniqThetaSketch. SyntaxuniqThetaSketch— uniqThetaSketch object.TupleorArrayorDateorDateTimeorStringor(U)Int*orFloat*orDecimal
UInt64
Examples
Usage example
Query
Response
uniqThetaNot
Introduced in: v22.9.0 Two uniqThetaSketch objects to do a_not_b calculation(set operation ×), the result is a new uniqThetaSketch. SyntaxuniqThetaSketch— uniqThetaSketch object.TupleorArrayorDateorDateTimeorStringor(U)Int*orFloat*orDecimal
UInt64
Examples
Usage example
Query
Response
uniqThetaUnion
Introduced in: v22.9.0 Two uniqThetaSketch objects to do union calculation(set operation ∪), the result is a new uniqThetaSketch. SyntaxuniqThetaSketch— uniqThetaSketch object.TupleorArrayorDateorDateTimeorStringor(U)Int*orFloat*orDecimal
UInt64
Examples
Usage example
Query
Response
uptime
Introduced in: v1.1.0 Returns the server’s uptime in seconds. If executed in the context of a distributed table, this function generates a normal column with values relevant to each shard. Otherwise it produces a constant value. Syntax- None.
UInt32
Examples
Usage example
Query
Response
variantElement
Introduced in: v25.2.0 Extracts a column with specified type from aVariant column.
Syntax
variant— Variant column.Varianttype_name— The name of the variant type to extract.Stringdefault_value— The default value that will be used if variant doesn’t have variant with specified type. Can be any type. Optional.Any
Any
Examples
Usage example
Query
Response
variantType
Introduced in: v24.2.0 Returns the variant type name for each row ofVariant column. If row contains NULL, it returns ‘None’ for it.
Syntax
variant— Variant column.Variant
Enum
Examples
Usage example
Query
Response
version
Introduced in: v1.1.0 Returns the current version of ClickHouse as a string in the form:major_version.minor_version.patch_version.number_of_commits_since_the_previous_stable_release.
If executed in the context of a distributed table, this function generates a normal column with values relevant to each shard.
Otherwise, it produces a constant value.
Syntax
- None.
String
Examples
Usage example
Query
Response
visibleWidth
Introduced in: v1.1.0 Calculates the approximate width when outputting values to the console in text format (tab-separated). This function is used by the system to implement Pretty formats.NULL is represented as a string corresponding to NULL in Pretty formats.
Syntax
x— A value of any data type.Any
UInt64
Examples
Calculate visible width of NULL
Query
Response
zookeeperSessionUptime
Introduced in: v21.11.0 Returns the uptime of the current ZooKeeper session in seconds. Syntax- None.
UInt32
Examples
Usage example
Query
Response