id stringlengths 36 36 | document stringlengths 3 3k | metadata stringlengths 23 69 | embeddings listlengths 384 384 |
|---|---|---|---|
505249dc-924e-4c2a-b841-6ce66858d244 | It means that
john
has the permission to execute:
SELECT x,y FROM db.table
.
SELECT x FROM db.table
.
SELECT y FROM db.table
.
john
can't execute
SELECT z FROM db.table
. The
SELECT * FROM db.table
also is not available. Processing this query, ClickHouse does not return any data, even
x
and
y
. The... | {"source_file": "grant.md"} | [
-0.009192137978971004,
-0.010001803748309612,
-0.07600075751543045,
0.022235019132494926,
-0.005533975549042225,
-0.03354606777429581,
0.07161202281713486,
-0.02471598982810974,
-0.06997369974851608,
0.04279102012515068,
-0.006819763220846653,
0.04039907082915306,
0.044365812093019485,
-0.... |
7afbd9a6-d6f8-4114-b15e-afdedc6f1384 | All newly created tables within granted paths will automatically inherit all grants from their parents.
For example, if you run the
GRANT SELECT ON db.* TO john
query and then create a new table
db.new_table
, the user
john
will be able to run the
SELECT * FROM db.new_table
query.
You can specify asterisk
onl... | {"source_file": "grant.md"} | [
-0.020893055945634842,
-0.09811028838157654,
-0.04244847223162651,
0.03082234412431717,
-0.11974890530109406,
-0.019058210775256157,
0.0350935123860836,
-0.04152793809771538,
-0.05163400620222092,
0.03276533633470535,
0.022593824192881584,
0.012189783155918121,
0.08661265671253204,
0.01171... |
ab69b18a-538a-43a4-854b-e90897f0dbed | DROP NAMED COLLECTION
NAMED COLLECTION
SHOW NAMED COLLECTIONS
SHOW NAMED COLLECTIONS SECRETS
OPTIMIZE
SELECT
SET DEFINER
SHOW
SHOW COLUMNS
SHOW DATABASES
SHOW DICTIONARIES
SHOW TABLES
SHOW FILESYSTEM CACHES
SOURCES
AZURE
FILE
HDFS
HIVE
JDBC
KAFKA
MONGO
MYSQL
NATS
... | {"source_file": "grant.md"} | [
-0.00529550202190876,
-0.05607304349541664,
-0.0902220606803894,
0.019380562007427216,
-0.04412590339779854,
-0.02682117000222206,
-0.008025220595300198,
-0.06511916220188141,
0.025031931698322296,
0.12799854576587677,
-0.0012026351178064942,
0.006717959884554148,
0.029113834723830223,
-0.... |
71cdfdcb-a697-46da-ad01-784d34cfdb9b | Examples of allowed syntax:
GRANT SELECT(x) ON db.table TO user
GRANT SELECT ON db.* TO user
Examples of disallowed syntax:
GRANT CREATE USER(x) ON db.table TO user
GRANT CREATE USER ON db.* TO user
The special privilege
ALL
grants all the privileges to a user account or a role.
By default, a us... | {"source_file": "grant.md"} | [
-0.0072371806018054485,
-0.03847765550017357,
-0.05397868528962135,
0.04157969728112221,
-0.12263654917478561,
-0.05327867344021797,
0.05915818735957146,
-0.009966817684471607,
-0.021808695048093796,
0.004650975111871958,
-0.021134521812200546,
-0.0008829215075820684,
0.09824562817811966,
... |
b929e5fe-9b11-4f78-b3fa-f2187ce2f581 | ALTER ADD INDEX
. Level:
TABLE
. Aliases:
ADD INDEX
ALTER DROP INDEX
. Level:
TABLE
. Aliases:
DROP INDEX
ALTER MATERIALIZE INDEX
. Level:
TABLE
. Aliases:
MATERIALIZE INDEX
ALTER CLEAR INDEX
. Level:
TABLE
. Aliases:
CLEAR INDEX
ALTER CONSTRAINT
. Level:
GROUP
. Aliases:
CONSTRAINT
ALTER ADD CONSTR... | {"source_file": "grant.md"} | [
-0.04441818967461586,
-0.02181733027100563,
0.008204953745007515,
0.05873880535364151,
0.01996602676808834,
0.032234616577625275,
0.060674190521240234,
-0.021570958197116852,
-0.023815229535102844,
0.04420599713921547,
0.018825707957148552,
-0.05686052143573761,
0.056471794843673706,
-0.00... |
92fcec86-bf70-4ce0-9f85-02cfac266eaf | text
Not enough privileges. To execute this query, it's necessary to have the grant CLUSTER ON *.*.
The default behavior can be changed by setting the
on_cluster_queries_require_cluster_grant
setting,
located in the
access_control_improvements
section of
config.xml
(see below), to
false
.
yaml title="config.... | {"source_file": "grant.md"} | [
0.06271480768918991,
-0.02309269644320011,
-0.07719694823026657,
0.08261318504810333,
-0.048016421496868134,
-0.0342923142015934,
0.07788026332855225,
-0.034010883420705795,
-0.02668016031384468,
-0.0005951429484412074,
0.07534655928611755,
-0.03965242579579353,
0.03729413077235222,
-0.016... |
2d12982a-f10a-4513-8331-765453fb14e4 | SHOW ACCESS
. Level:
GROUP
SHOW_USERS
. Level:
GLOBAL
. Aliases:
SHOW CREATE USER
SHOW_ROLES
. Level:
GLOBAL
. Aliases:
SHOW CREATE ROLE
SHOW_ROW_POLICIES
. Level:
GLOBAL
. Aliases:
SHOW POLICIES
,
SHOW CREATE ROW POLICY
,
SHOW CREATE POLICY
SHOW_QUOTAS
. Level:
GLOBAL
. Aliases:
SHOW CREATE QUOTA
... | {"source_file": "grant.md"} | [
-0.0460330955684185,
0.016324231401085854,
-0.0541263222694397,
0.05528019368648529,
-0.06978050619363785,
-0.014180360361933708,
0.10247094929218292,
-0.013921472243964672,
-0.05746250972151756,
0.01037632580846548,
-0.017648499459028244,
-0.015733754262328148,
0.0988619402050972,
-0.0020... |
382cdabd-11d9-4292-a985-a5b3c9c736e3 | SYSTEM RESTART REPLICA
. Level:
TABLE
. Aliases:
RESTART REPLICA
SYSTEM FLUSH
. Level:
GROUP
SYSTEM FLUSH DISTRIBUTED
. Level:
TABLE
. Aliases:
FLUSH DISTRIBUTED
SYSTEM FLUSH LOGS
. Level:
GLOBAL
. Aliases:
FLUSH LOGS
The
SYSTEM RELOAD EMBEDDED DICTIONARIES
privilege implicitly granted by the
SY... | {"source_file": "grant.md"} | [
-0.02370450273156166,
-0.04877614229917526,
-0.06947679817676544,
0.023778118193149567,
-0.0008279957110062242,
-0.04845514893531799,
-0.012004966847598553,
-0.04840073361992836,
0.027084099128842354,
0.1437428891658783,
-0.02688036672770977,
0.03411336615681648,
0.017926765605807304,
-0.0... |
4479db40-5388-41d7-9b81-9f15fe104c31 | sql
GRANT READ ON URL('https://www\.google\.com') TO john;
:::
Re-granting with GRANT OPTION:
If the original grant has
WITH GRANT OPTION
, it can be re-granted using
GRANT CURRENT GRANTS
:
```sql
-- Original grant with GRANT OPTION
GRANT READ ON S3('s3://foo/.*') TO john WITH GRANT OPTION
-- John can now regr... | {"source_file": "grant.md"} | [
-0.07662719488143921,
0.03077680617570877,
0.03063674457371235,
-0.03651680797338486,
-0.057171549648046494,
-0.05471307039260864,
0.06779120117425919,
-0.10682522505521774,
-0.03991685062646866,
-0.015883849933743477,
-0.06036444008350372,
-0.0018261621007695794,
0.08419740945100784,
-0.0... |
2e251251-c4d4-450c-9ba1-ae1e988cdceb | Examples
GRANT TABLE ENGINE ON * TO john
GRANT TABLE ENGINE ON TinyLog TO john
ALL {#all}
Grants all the privileges on regulated entity to a user account or a role.
:::note
The privilege
ALL
is not supported in ClickHouse Cloud, where the
default
user has limited permissions. Users can grant the max... | {"source_file": "grant.md"} | [
0.0336238257586956,
-0.009841847233474255,
-0.009126664139330387,
0.004796538036316633,
0.009145253337919712,
0.034418992698192596,
0.03450940549373627,
-0.04949764162302017,
-0.03657639026641846,
0.05862931162118912,
0.04019976407289505,
-0.0018149024108424783,
0.011876560747623444,
0.045... |
477b1aa9-cd96-47a4-995b-9ed3bd9fd662 | description: 'Documentation for Kill'
sidebar_label: 'KILL'
sidebar_position: 46
slug: /sql-reference/statements/kill
title: 'KILL Statements'
doc_type: 'reference'
There are two kinds of kill statements: to kill a query and to kill a mutation
KILL QUERY {#kill-query}
sql
KILL QUERY [ON CLUSTER cluster]
WHERE... | {"source_file": "kill.md"} | [
0.06222575157880783,
-0.00862391572445631,
-0.02778257057070732,
0.03110680729150772,
0.035143643617630005,
-0.04457666352391243,
0.029996097087860107,
-0.021663958206772804,
-0.04911819472908974,
0.04776734113693237,
0.025398673489689827,
0.010519691742956638,
0.035536181181669235,
-0.130... |
aa58e200-35ae-4742-b634-426fc085ecc3 | Or manually kill some of these mutations by sending a
KILL
command.
sql
KILL MUTATION
WHERE <where expression to SELECT FROM system.mutations query>
[TEST]
[FORMAT format]
Tries to cancel and remove
mutations
that are currently executing. Mutations to cancel are selected from the
system.mutations
tabl... | {"source_file": "kill.md"} | [
0.04627000540494919,
0.0061942473985254765,
-0.06814470142126083,
0.005633241031318903,
0.018336089327931404,
-0.10094019770622253,
0.04641922935843468,
-0.032921984791755676,
-0.01746019348502159,
0.05174032971262932,
0.03586976230144501,
-0.018670249730348587,
0.10403421521186829,
-0.060... |
e74f7801-6525-43b6-9cd8-3e49a7a2c819 | description: 'Documentation for Explain'
sidebar_label: 'EXPLAIN'
sidebar_position: 39
slug: /sql-reference/statements/explain
title: 'EXPLAIN Statement'
doc_type: 'reference'
Shows the execution plan of a statement.
Syntax:
sql
EXPLAIN [AST | SYNTAX | QUERY TREE | PLAN | PIPELINE | ESTIMATE | TABLE OVE... | {"source_file": "explain.md"} | [
-0.012866156175732613,
0.04895195737481117,
0.015162291005253792,
0.0462118424475193,
-0.042043957859277725,
0.020261626690626144,
0.05454413965344429,
0.11567455530166626,
-0.04313143342733383,
0.07328849285840988,
-0.016253184527158737,
0.006461312994360924,
0.050250474363565445,
-0.0740... |
17223019-a411-44b9-8d78-265d3e82b65f | query_tree_passes
β If
run_query_tree_passes
is set, specifies how many passes to run. Without specifying
query_tree_passes
it runs all the passes.
Examples:
sql
EXPLAIN SYNTAX SELECT * FROM system.numbers AS a, system.numbers AS b, system.numbers AS c WHERE a.number = b.number AND b.number = c.number;
Out... | {"source_file": "explain.md"} | [
0.05654782056808472,
-0.0038848614785820246,
-0.021279212087392807,
0.035848468542099,
-0.03790760040283203,
-0.07496568560600281,
0.06350033730268478,
0.057954512536525726,
-0.023628920316696167,
0.0024864168372005224,
-0.09419189393520355,
0.006950057111680508,
0.033940088003873825,
-0.1... |
7094a2af-0b83-4ddd-84b7-85414df343dd | actions
β Prints detailed information about step actions. Default: 0.
json
β Prints query plan steps as a row in
JSON
format. Default: 0. It is recommended to use
TabSeparatedRaw (TSVRaw)
format to avoid unnecessary escaping.
input_headers
- Prints input headers for step. Default: 0. Mostly useful only for d... | {"source_file": "explain.md"} | [
-0.0959932878613472,
0.07214289158582687,
-0.056037358939647675,
0.06228606775403023,
-0.0395052395761013,
-0.01342024002224207,
0.007409712299704552,
0.07408642023801804,
-0.023360328748822212,
0.04629919305443764,
-0.01964307390153408,
-0.010930468328297138,
0.05763985216617584,
-0.04065... |
9b2f2134-e35b-4849-9515-029df698d851 | Name
β The index name (currently only used for
Skip
indexes).
Keys
β The array of columns used by the index.
Condition
β The used condition.
Description
β The index description (currently only used for
Skip
indexes).
Parts
β The number of parts after/before the index is applied.
Granules
β The numb... | {"source_file": "explain.md"} | [
-0.00899919867515564,
0.05980311334133148,
-0.0007490521529689431,
0.019633371382951736,
0.012991568073630333,
-0.04026847705245018,
0.01769479177892208,
0.011521447449922562,
0.021633394062519073,
-0.048174940049648285,
-0.03671388700604439,
0.014713590033352375,
0.05993443354964256,
-0.0... |
69e613d1-35c8-454e-b822-c6398ce52ca0 | With
actions
= 1, added keys depend on step type.
Example:
sql
EXPLAIN json = 1, actions = 1, description = 0 SELECT 1 FORMAT TSVRaw;
json
[
{
"Plan": {
"Node Type": "Expression",
"Node Id": "Expression_5",
"Expression": {
"Inputs": [
{
"Name": "dummy",
... | {"source_file": "explain.md"} | [
-0.06158534064888954,
0.05271788686513901,
-0.044209592044353485,
0.056813858449459076,
-0.0475844107568264,
0.035072699189186096,
0.007538842968642712,
0.058579206466674805,
0.004036032594740391,
0.051105618476867676,
-0.037540219724178314,
-0.00620108051225543,
-0.00750677241012454,
0.01... |
bce55b17-a861-485b-b2dd-7f8356375a78 | Example
Assume you have a remote MySQL table like this:
sql
CREATE TABLE db.tbl (
id INT PRIMARY KEY,
created DATETIME DEFAULT now()
)
sql
EXPLAIN TABLE OVERRIDE mysql('127.0.0.1:3306', 'db', 'tbl', 'root', 'clickhouse')
PARTITION BY toYYYYMM(assumeNotNull(created))
Result:
text
ββexplainβββββββββββββ... | {"source_file": "explain.md"} | [
0.005914496723562479,
-0.025842811912298203,
0.06266205757856369,
0.037556856870651245,
-0.01615128293633461,
-0.05870337784290314,
-0.014565784484148026,
0.05269669368863106,
-0.01381386537104845,
0.053379688411951065,
0.05354761332273483,
-0.006996442563831806,
0.10795818269252777,
0.003... |
7e0eaf6a-3f51-4106-aba8-2066d0837ca7 | description: 'Documentation for Describe Table'
sidebar_label: 'DESCRIBE TABLE'
sidebar_position: 42
slug: /sql-reference/statements/describe-table
title: 'DESCRIBE TABLE'
doc_type: 'reference'
Returns information about table columns.
Syntax
sql
DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT for... | {"source_file": "describe-table.md"} | [
-0.016906121745705605,
0.007312793750315905,
-0.05255288630723953,
0.08547594398260117,
-0.006611478049308062,
-0.04599074646830559,
0.0054717352613806725,
0.08740326762199402,
-0.008506487123668194,
0.03489984571933746,
0.00471761217340827,
-0.05604711174964905,
0.024512501433491707,
-0.0... |
c9aa1913-2e65-4d9c-a95f-3043f82b70f8 | The second query additionally shows subcolumns:
text
ββnameβββββββ¬βtypeβββββββββββββββββββββββββββ¬βdefault_typeββ¬βdefault_expressionββ¬βcommentββ¬βcodec_expressionββ¬βttl_expressionββ¬βis_subcolumnββ
β id β UInt64 β β β β β ... | {"source_file": "describe-table.md"} | [
0.023473074659705162,
0.013474094681441784,
-0.03207416832447052,
0.0736331045627594,
0.021978622302412987,
-0.008573448285460472,
-0.020842915400862694,
0.04070199280977249,
-0.03491174057126045,
-0.04482465237379074,
0.05792883783578873,
-0.03591499850153923,
0.06890426576137543,
-0.0898... |
d6374d76-6552-45cf-b6d3-5d3d1897480d | description: 'Documentation for DROP Statements'
sidebar_label: 'DROP'
sidebar_position: 44
slug: /sql-reference/statements/drop
title: 'DROP Statements'
doc_type: 'reference'
DROP Statements
Deletes existing entity. If the
IF EXISTS
clause is specified, these queries do not return an error if the entity does n... | {"source_file": "drop.md"} | [
-0.028229398652911186,
-0.046459682285785675,
0.020329803228378296,
0.07117266207933426,
0.07351266592741013,
-0.041188061237335205,
0.05859668180346489,
-0.07331039756536484,
0.04086887091398239,
0.027038006111979485,
0.09884141385555267,
-0.005566689185798168,
0.10472792387008667,
-0.074... |
b6a02f33-662c-4a20-9050-25ea64b8c592 | Example
sql
CREATE FUNCTION linear_equation AS (x, k, b) -> k*x + b;
DROP FUNCTION linear_equation;
DROP NAMED COLLECTION {#drop-named-collection}
Deletes a named collection.
Syntax
sql
DROP NAMED COLLECTION [IF EXISTS] name [on CLUSTER cluster]
Example
sql
CREATE NAMED COLLECTION foobar AS a = '1', b = '... | {"source_file": "drop.md"} | [
-0.019045017659664154,
-0.005469586234539747,
-0.05562514811754227,
0.06420280784368515,
-0.0804433673620224,
-0.007346742320805788,
0.029738957062363625,
-0.06653112918138504,
0.01223013922572136,
0.05608872324228287,
0.08196640014648438,
-0.0901063084602356,
0.045651454478502274,
-0.0408... |
bb35471f-2280-44cc-af96-a04ed6cce294 | description: 'Documentation for WATCH Statement'
sidebar_label: 'WATCH'
sidebar_position: 53
slug: /sql-reference/statements/watch
title: 'WATCH Statement'
doc_type: 'reference'
import DeprecatedBadge from '@theme/badges/DeprecatedBadge';
WATCH Statement
This feature is deprecated and will be removed in the f... | {"source_file": "watch.md"} | [
-0.04855426773428917,
0.009380587376654148,
-0.019077671691775322,
0.08381610363721848,
0.0673307403922081,
0.1026524007320404,
0.058819323778152466,
-0.01173283439129591,
0.000031768024200573564,
-0.0052872877568006516,
-0.020076287910342216,
0.04548631235957146,
0.033123839646577835,
-0.... |
9c23037a-e03a-46b1-9ca3-0d2f482f368d | description: 'Documentation for SET Statement'
sidebar_label: 'SET'
sidebar_position: 50
slug: /sql-reference/statements/set
title: 'SET Statement'
doc_type: 'reference'
SET Statement
sql
SET param = value
Assigns
value
to the
param
setting
for the current session. You cannot change
server settings
this... | {"source_file": "set.md"} | [
0.05578535050153732,
0.030819032341241837,
-0.04672791063785553,
0.10915497690439224,
-0.1317550241947174,
0.06770457327365875,
0.08207416534423828,
0.08440985530614853,
-0.11671314388513565,
0.01956818625330925,
0.00041412728023715317,
-0.02843770571053028,
0.09737776219844818,
-0.0689051... |
d987f083-4af5-4c0f-985a-832e43581efe | description: 'Documentation for Set Role'
sidebar_label: 'SET ROLE'
sidebar_position: 51
slug: /sql-reference/statements/set-role
title: 'SET ROLE Statement'
doc_type: 'reference'
Activates roles for the current user.
sql
SET ROLE {DEFAULT | NONE | role [,...] | ALL | ALL EXCEPT role [,...]}
SET DEFAULT ROLE {#... | {"source_file": "set-role.md"} | [
0.0391402468085289,
-0.06455715745687485,
0.01340185385197401,
0.042700182646512985,
-0.11912869662046432,
0.036515429615974426,
0.0717700943350792,
-0.01472658570855856,
-0.14808331429958344,
-0.048875097185373306,
0.003750920994207263,
0.0029764934442937374,
0.09228824824094772,
0.015560... |
d96cd084-571e-471f-9b82-fb33c41e84c1 | description: 'Documentation for USE Statement'
sidebar_label: 'USE'
sidebar_position: 53
slug: /sql-reference/statements/use
title: 'USE Statement'
doc_type: 'reference'
USE Statement
sql
USE [DATABASE] db
Lets you set the current database for the session.
The current database is used for searching for tables... | {"source_file": "use.md"} | [
-0.007880587130784988,
0.03674396872520447,
-0.08003626018762589,
0.06756925582885742,
-0.07295425236225128,
0.012815018184483051,
0.11497809737920761,
0.03712828829884529,
-0.0012336267391219735,
0.00991166103631258,
0.005418103653937578,
-0.0059183379635214806,
0.07611369341611862,
-0.04... |
5b61a4a5-5252-40a3-9219-494ea1bdc9a1 | description: 'Documentation for Check Grant'
sidebar_label: 'CHECK GRANT'
sidebar_position: 56
slug: /sql-reference/statements/check-grant
title: 'CHECK GRANT Statement'
doc_type: 'reference'
The
CHECK GRANT
query is used to check whether the current user/role has been granted a specific privilege.
Syntax {#syn... | {"source_file": "check-grant.md"} | [
0.01687898300588131,
0.020560849457979202,
-0.007723632268607616,
0.0377030223608017,
-0.0218832865357399,
-0.04514952376484871,
0.1222408264875412,
0.006132469512522221,
-0.03673815727233887,
-0.011034499853849411,
0.013985816389322281,
-0.061642952263355255,
0.06256042420864105,
-0.04087... |
03aa40c3-4e6d-42cd-b4e2-b56097b9baca | description: 'Documentation for RENAME Statement'
sidebar_label: 'RENAME'
sidebar_position: 48
slug: /sql-reference/statements/rename
title: 'RENAME Statement'
doc_type: 'reference'
RENAME Statement
Renames databases, tables, or dictionaries. Several entities can be renamed in a single query.
Note that the
RENAM... | {"source_file": "rename.md"} | [
0.058010030537843704,
-0.06190846487879753,
0.02419905550777912,
0.0559798888862133,
-0.051029328256845474,
-0.03742705658078194,
0.0655239075422287,
0.00726915942505002,
0.033936381340026855,
0.04414175823330879,
0.08911533653736115,
-0.009429484605789185,
0.07005278766155243,
-0.06811654... |
a0d1e871-45fb-448d-a5d4-b98ddcac8cd4 | description: 'Documentation for ClickHouse SQL Statements'
sidebar_label: 'List of statements'
sidebar_position: 1
slug: /sql-reference/statements/
title: 'ClickHouse SQL Statements'
doc_type: 'reference'
ClickHouse SQL Statements
Users interact with ClickHouse using SQL statements. ClickHouse supports common SQL... | {"source_file": "index.md"} | [
0.02285257913172245,
-0.052681367844343185,
-0.054703906178474426,
0.06334425508975983,
-0.028495818376541138,
-0.01852821372449398,
0.07861415296792984,
0.014609599485993385,
-0.0792018473148346,
-0.010952954180538654,
0.017266562208533287,
0.01776058040559292,
0.04775676876306534,
-0.078... |
e0d129cb-d88e-4e58-a321-0a418ee9e0c1 | description: 'Documentation for EXISTS Statement'
sidebar_label: 'EXISTS'
sidebar_position: 45
slug: /sql-reference/statements/exists
title: 'EXISTS Statement'
doc_type: 'reference'
EXISTS Statement
sql
EXISTS [TEMPORARY] [TABLE|DICTIONARY|DATABASE] [db.]name [INTO OUTFILE filename] [FORMAT format]
Returns a si... | {"source_file": "exists.md"} | [
0.0038585374131798744,
0.01579095609486103,
-0.0936727374792099,
0.07268772274255753,
0.015791088342666626,
0.0014322432689368725,
0.02724970132112503,
0.07822324335575104,
0.025067416951060295,
0.0037330614868551493,
0.060938239097595215,
-0.06648807227611542,
0.0833326056599617,
-0.09909... |
6903d564-c13b-47bd-9912-e7b3bfd76ea5 | description: 'Documentation for Optimize'
sidebar_label: 'OPTIMIZE'
sidebar_position: 47
slug: /sql-reference/statements/optimize
title: 'OPTIMIZE Statement'
doc_type: 'reference'
This query tries to initialize an unscheduled merge of data parts for tables. Note that we generally recommend against using
OPTIMIZE T... | {"source_file": "optimize.md"} | [
0.02750357985496521,
-0.0062935128808021545,
0.01888437755405903,
0.036270689219236374,
-0.00583071680739522,
-0.08187677711248398,
0.04244433343410492,
0.042878638952970505,
-0.04409363493323326,
0.015717552974820137,
0.01377086341381073,
-0.008505024015903473,
0.026173653081059456,
-0.05... |
a44efd2e-2260-4a1f-a9f5-b5d6e3a024e3 | Also, it is an error to specify empty list of columns, or write an expression that results in an empty list of columns, or deduplicate by an
ALIAS
column.
:::
Syntax
sql
OPTIMIZE TABLE table DEDUPLICATE; -- all columns
OPTIMIZE TABLE table DEDUPLICATE BY *; -- excludes MATERIALIZED and ALIAS columns
OPTIMIZE TABL... | {"source_file": "optimize.md"} | [
0.011375212110579014,
0.020677246153354645,
0.00911223515868187,
-0.018360963091254234,
-0.015748102217912674,
-0.06954652816057205,
0.0581534281373024,
0.0608673132956028,
-0.012309761717915535,
0.061982329934835434,
0.049236711114645004,
-0.02690749056637287,
0.09417020529508591,
-0.0654... |
fdcc9cfc-3d0b-4694-94fb-77a59a0bc010 | DEDUPLICATE BY *
{#deduplicate-by-}
When columns are specified implicitly, the table is deduplicated by all columns that are not
ALIAS
or
MATERIALIZED
. Considering the table above, these are
primary_key
,
secondary_key
,
value
, and
partition_key
columns:
sql
OPTIMIZE TABLE example FINAL DEDUPLICATE BY *;... | {"source_file": "optimize.md"} | [
-0.020420433953404427,
-0.01151272188872099,
0.015700388699769974,
-0.009482868015766144,
-0.0009340166579931974,
-0.1248195543885231,
0.03564534708857536,
0.01743903197348118,
-0.011267926543951035,
0.031873855739831924,
0.08437497913837433,
0.009099439717829227,
0.04171779006719589,
-0.0... |
4d87a7ca-1676-494a-86dd-c2166721844e | sql
OPTIMIZE TABLE example FINAL DEDUPLICATE BY COLUMNS('.*_key');
sql
SELECT * FROM example;
Result:
response
ββprimary_keyββ¬βsecondary_keyββ¬βvalueββ¬βpartition_keyββ
β 0 β 0 β 0 β 0 β
βββββββββββββββ΄ββββββββββββββββ΄ββββββββ΄ββββββββββββββββ
ββprimary_keyββ¬βsecondary_keyββ¬βval... | {"source_file": "optimize.md"} | [
0.021190425381064415,
-0.015636257827281952,
-0.01336949784308672,
0.017475666478276253,
-0.06203790009021759,
-0.09797690808773041,
0.0825750082731247,
-0.016877979040145874,
-0.010011591948568821,
0.03167478367686272,
0.11920204758644104,
0.02781723439693451,
0.05447356402873993,
-0.1216... |
f65ec240-c8ad-4179-b587-cd6b0a67c013 | description: 'Lightweight deletes simplify the process of deleting data from the database.'
keywords: ['delete']
sidebar_label: 'DELETE'
sidebar_position: 36
slug: /sql-reference/statements/delete
title: 'The Lightweight DELETE Statement'
doc_type: 'reference'
The lightweight
DELETE
statement removes rows from th... | {"source_file": "delete.md"} | [
-0.015349290333688259,
-0.007453207857906818,
0.004618214908987284,
0.07113650441169739,
0.0611790306866169,
-0.11507324129343033,
0.04973997548222542,
-0.05087713524699211,
0.03242511302232742,
0.02548290230333805,
0.0596906878054142,
0.018077518790960312,
0.05402759462594986,
-0.07404165... |
7294db9f-1acb-4272-9b7a-119d6f30602f | Performance considerations when using lightweight
DELETE
{#performance-considerations-when-using-lightweight-delete}
Deleting large volumes of data with the lightweight
DELETE
statement can negatively affect SELECT query performance.
The following can also negatively impact lightweight
DELETE
performance:
... | {"source_file": "delete.md"} | [
-0.00930482055991888,
0.013259769417345524,
-0.04203273355960846,
0.041459403932094574,
0.039248026907444,
-0.12325925379991531,
0.0465213805437088,
-0.07108265161514282,
0.02807978354394436,
-0.00046021046000532806,
0.051913920789957047,
0.01648419164121151,
0.05409357696771622,
-0.041599... |
5e537fab-cc30-4782-b65c-e1f46e536523 | From the steps above, we can see that lightweight
DELETE
using the masking technique improves performance over traditional
ALTER TABLE ... DELETE
because it does not re-write all the columns' files for affected parts.
Related content {#related-content}
Blog:
Handling Updates and Deletes in ClickHouse | {"source_file": "delete.md"} | [
0.002204200020059943,
0.0038692352827638388,
-0.029061879962682724,
0.016613977029919624,
0.1035730168223381,
-0.07413965463638306,
-0.043197546154260635,
-0.10379309207201004,
0.007309907581657171,
0.03792395070195198,
0.06714877486228943,
0.0767396092414856,
0.045582618564367294,
-0.0409... |
c032ed4b-4661-4ac7-abf8-770edd507ae7 | description: 'Lightweight updates simplify the process of updating data in the database using patch parts.'
keywords: ['update']
sidebar_label: 'UPDATE'
sidebar_position: 39
slug: /sql-reference/statements/update
title: 'The Lightweight UPDATE Statement'
doc_type: 'reference'
import BetaBadge from '@theme/badges/Be... | {"source_file": "update.md"} | [
-0.004280535038560629,
-0.00642660865560174,
0.01571909338235855,
0.05228729918599129,
0.004641788080334663,
-0.06719039380550385,
0.06480910629034042,
-0.0019687763415277004,
-0.0890253484249115,
0.06564518809318542,
0.033143557608127594,
-0.018174126744270325,
0.031214691698551178,
-0.15... |
62846310-4706-4878-a23f-0a04ce14b6ba | Performance considerations {#performance-considerations}
Advantages of lightweight updates:
- The latency of the update is comparable to the latency of the
INSERT ... SELECT ...
query
- Only updated columns and values are written, not entire columns in data parts
- No need to wait for currently running merges/muta... | {"source_file": "update.md"} | [
-0.035250723361968994,
0.021015077829360962,
-0.006638084538280964,
0.019641088321805,
0.046437978744506836,
-0.07177306711673737,
-0.032084617763757706,
0.00037134249578230083,
0.023996740579605103,
0.063560351729393,
0.02310873754322529,
0.058605827391147614,
-0.009757915511727333,
-0.11... |
5a6434da-6f14-4425-98a9-c88ffd9b8379 | Patch parts belong to different partitions than the original part.
The partition id of the patch part is
patch-<hash of column names in patch part>-<original_partition_id>
.
Therefore patch parts with different columns are stored in different partitions.
For example three updates
SET x = 1 WHERE <cond>
,
SET y = 1 W... | {"source_file": "update.md"} | [
-0.03958180174231529,
-0.005365775898098946,
0.051286809146404266,
-0.0606013722717762,
0.02916116639971733,
-0.08397934585809708,
0.002291994635015726,
-0.012919708155095577,
0.008243030868470669,
0.005866959225386381,
0.026538345962762833,
0.0798228457570076,
0.011697886511683464,
-0.100... |
2d9b7d34-9729-4ac4-a795-6c940baee9ba | description: 'Documentation for SYSTEM Statements'
sidebar_label: 'SYSTEM'
sidebar_position: 36
slug: /sql-reference/statements/system
title: 'SYSTEM Statements'
doc_type: 'reference'
import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge';
SYSTEM Statements
SYSTEM RELOAD EMBEDDED DICTIONARIES... | {"source_file": "system.md"} | [
0.007980979047715664,
-0.037991926074028015,
-0.031271010637283325,
0.05176457762718201,
-0.010598498396575451,
-0.07118739932775497,
0.03113173507153988,
-0.04303041100502014,
-0.01968165673315525,
0.02469467744231224,
0.05687809735536575,
0.06007016450166702,
0.058681514114141464,
-0.055... |
2f3553c2-876a-4ce1-8c53-4ad84b7ae89b | For more convenient (automatic) cache management, see
disable_internal_dns_cache
,
dns_cache_max_entries
,
dns_cache_update_period
parameters.
SYSTEM DROP MARK CACHE {#drop-mark-cache}
Clears the mark cache.
SYSTEM DROP ICEBERG METADATA CACHE {#drop-iceberg-metadata-cache}
Clears the iceberg metadata cache.... | {"source_file": "system.md"} | [
-0.045490264892578125,
0.04159369692206383,
-0.024740757420659065,
0.004990313667804003,
-0.04219413176178932,
-0.06331390887498856,
0.002404256723821163,
-0.049860529601573944,
-0.015242837369441986,
0.06912409514188766,
0.03258087858557701,
0.03933924436569214,
0.029188338667154312,
-0.0... |
edd574f4-9ba7-456e-b317-7820e0ba5139 | Similar to
SYSTEM DROP REPLICA
, but removes the
Replicated
database replica path from ZooKeeper when there's no database to run
DROP DATABASE
. Please note that it does not remove
ReplicatedMergeTree
replicas (so you may need
SYSTEM DROP REPLICA
as well). Shard and replica names are the names that were specifi... | {"source_file": "system.md"} | [
-0.0049987914972007275,
0.010701204650104046,
0.002054633107036352,
0.02520623616874218,
0.014782769605517387,
-0.0386168472468853,
-0.03178752213716507,
-0.050153665244579315,
0.004938118159770966,
0.02725774236023426,
-0.010203556157648563,
0.009312845766544342,
0.06869141757488251,
-0.0... |
9132a43d-f2f6-45b9-8c81-41d58a72f512 | sql
SYSTEM RELOAD CONFIG [ON CLUSTER cluster_name]
SYSTEM RELOAD USERS {#reload-users}
Reloads all access storages, including: users.xml, local disk access storage, replicated (in ZooKeeper) access storage.
sql
SYSTEM RELOAD USERS [ON CLUSTER cluster_name]
SYSTEM SHUTDOWN {#shutdown}
Normally shuts down Cli... | {"source_file": "system.md"} | [
0.04579711705446243,
-0.0585627518594265,
-0.06052076816558838,
0.062294505536556244,
-0.04574044048786163,
-0.07192027568817139,
0.04654707387089729,
-0.037502534687519073,
0.001562981284223497,
0.1081204041838646,
0.032933976501226425,
0.040424276143312454,
0.07287086546421051,
-0.034006... |
8e5619d8-b49c-490c-8084-757fc182b79a | If
CUSTOM 'protocol'
modifier is specified, the custom protocol with the specified name defined in the protocols section of the server configuration will be stopped.
If
QUERIES ALL [EXCEPT .. [,..]]
modifier is specified, all protocols are stopped, unless specified with
EXCEPT
clause.
If
QUERIES DEFAULT [EXC... | {"source_file": "system.md"} | [
0.03652067482471466,
-0.07325749099254608,
-0.06335359811782837,
-0.03511599451303482,
-0.03098716400563717,
-0.013917551375925541,
0.0633292943239212,
-0.05931289866566658,
-0.02899288572371006,
0.008956360630691051,
0.013442485593259335,
0.03304513171315193,
0.008989428170025349,
-0.0198... |
66b334bf-0d29-463c-8b3c-53196974bd22 | sql
SYSTEM STOP MOVES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
SYSTEM START MOVES {#start-moves}
Provides possibility to start background move data according to
TTL table expression with TO VOLUME and TO DISK clause
for tables in the MergeTree family:
Returns
Ok.
even if table does not exis... | {"source_file": "system.md"} | [
0.01447566319257021,
-0.08965438604354858,
-0.014766906388103962,
0.03627628833055496,
-0.013503333553671837,
-0.0699855387210846,
0.014704541303217411,
0.0016662220004945993,
0.022826530039310455,
0.03146391361951828,
0.059115082025527954,
-0.006773281842470169,
0.0701587051153183,
-0.056... |
7bda7785-0532-4239-a7fd-8cac82343cf3 | sql
SYSTEM STOP REPLICATION QUEUES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
SYSTEM START REPLICATION QUEUES {#start-replication-queues}
Provides possibility to start background fetch tasks from replication queues which stored in Zookeeper for tables in the
ReplicatedMergeTree
famil... | {"source_file": "system.md"} | [
0.0007345683989115059,
-0.0945834293961525,
-0.04579753056168556,
0.02231021411716938,
0.027804726734757423,
-0.11353449523448944,
0.01262836717069149,
-0.07619783282279968,
0.01892160065472126,
0.09086073189973831,
0.03968638926744461,
-0.019794965162873268,
0.04427453130483627,
0.0072283... |
ecefb7d4-a53f-43ed-9cfb-b586a2395e5c | SYNC DATABASE REPLICA {#sync-database-replica}
Waits until the specified
replicated database
applies all schema changes from the DDL queue of that database.
Syntax
sql
SYSTEM SYNC DATABASE REPLICA replicated_database_name;
SYSTEM RESTART REPLICA {#restart-replica}
Provides possibility to reinitialize Zookee... | {"source_file": "system.md"} | [
-0.019224556162953377,
-0.06821167469024658,
0.010410602204501629,
0.026706594973802567,
0.012937542051076889,
-0.07619233429431915,
-0.036843396723270416,
-0.05950522795319557,
0.0059001510962843895,
0.06941331923007965,
0.004184483550488949,
-0.01743238791823387,
0.0823785811662674,
0.01... |
8d6f116f-1ecd-4075-b8f9-6968651b9473 | SYSTEM RESTART REPLICA test;
SYSTEM RESTORE REPLICA test;
```
Another way:
sql
SYSTEM RESTORE REPLICA test ON CLUSTER cluster;
SYSTEM RESTART REPLICAS {#restart-replicas}
Provides possibility to reinitialize Zookeeper sessions state for all
ReplicatedMergeTree
tables, will compare current state with Zookeeper... | {"source_file": "system.md"} | [
-0.02693280577659607,
-0.05413704365491867,
-0.041241396218538284,
0.020342275500297546,
0.011016028001904488,
-0.061835430562496185,
0.0025877130683511496,
-0.028700819239020348,
-0.04901088401675224,
0.10516397655010223,
0.018582841381430626,
0.04134588688611984,
0.05447700619697571,
-0.... |
7ebf381c-c2f8-4bd6-97b7-951ad18c8619 | Can be used right after creating a new refreshable materialized view (without EMPTY keyword) to wait for the initial refresh to complete.
If the view is in a Replicated or Shared database, and refresh is running on another replica, waits for that refresh to complete.
sql
SYSTEM WAIT VIEW [db.]name | {"source_file": "system.md"} | [
-0.056834980845451355,
-0.09886039048433304,
-0.06723573058843613,
0.03944990411400795,
-0.03148069232702255,
0.012358495965600014,
0.00006796255911467597,
-0.0715327337384224,
0.034788213670253754,
0.041605010628700256,
0.03581686317920685,
-0.015447522513568401,
0.019882842898368835,
-0.... |
e4f959f0-f73c-482e-acee-22a5df44a062 | description: 'Documentation for Show'
sidebar_label: 'SHOW'
sidebar_position: 37
slug: /sql-reference/statements/show
title: 'SHOW Statements'
doc_type: 'reference'
:::note
SHOW CREATE (TABLE|DATABASE|USER)
hides secrets unless the following settings are turned on:
display_secrets_in_show_and_select
(server... | {"source_file": "show.md"} | [
-0.026067858561873436,
-0.005450452212244272,
-0.12132467329502106,
0.08008518815040588,
-0.0968775525689125,
0.02734282799065113,
0.06183045729994774,
0.07977743446826935,
-0.04872693493962288,
0.02952638640999794,
0.020563453435897827,
-0.06862981617450714,
0.11384090781211853,
-0.056705... |
1ee36921-2c59-4c01-bbbf-1562ffc9fcb4 | If the
FROM
clause is not specified, the query returns a list of tables from the current database.
This statement is identical to the query:
sql
SELECT name FROM system.tables [WHERE name [NOT] LIKE | ILIKE '<pattern>'] [LIMIT <N>] [INTO OUTFILE <filename>] [FORMAT <format>]
Examples {#examples-1}
In this exa... | {"source_file": "show.md"} | [
0.005839201156049967,
0.008413502015173435,
0.01753753051161766,
0.06518620252609253,
-0.013044893741607666,
-0.042452916502952576,
0.13397245109081268,
0.06173508241772652,
-0.06475350260734558,
-0.01813347637653351,
0.05391056835651398,
-0.017768360674381256,
0.15945059061050415,
-0.0745... |
0fcb8305-f1a0-4e03-afd2-2ce1e421e780 | The
SHOW COLUMNS
statement produces a result table with the following structure:
| Column | Description | Type |
|-------------|-------------------------------------------------------... | {"source_file": "show.md"} | [
-0.00523718586191535,
0.05113906040787697,
-0.08320138603448868,
0.037664737552404404,
-0.06256494671106339,
-0.025781655684113503,
0.04169537127017975,
0.02416839450597763,
-0.02268100716173649,
-0.02363031730055809,
0.03584519028663635,
-0.06635473668575287,
0.11909182369709015,
-0.04918... |
51052c9b-4bf1-4feb-92f2-55c502d9e6db | If the
FROM
clause is not specified, the query returns the list of dictionaries from the current database.
You can get the same results as the
SHOW DICTIONARIES
query in the following way:
sql
SELECT name FROM system.dictionaries WHERE database = <db> [AND name LIKE <pattern>] [LIMIT <N>] [INTO OUTFILE <filenam... | {"source_file": "show.md"} | [
0.029966209083795547,
0.02339552529156208,
-0.023550648242235184,
0.05390942096710205,
0.015365096740424633,
-0.05440814793109894,
0.11137410998344421,
0.020669298246502876,
-0.06616043299436569,
-0.005569688510149717,
0.023821817710995674,
0.016879862174391747,
0.13415317237377167,
-0.124... |
ba0bc824-882e-4d3c-89ba-7addd1093459 | The optional keyword
EXTENDED
currently has no effect, and exists for MySQL compatibility.
The statement produces a result table with the following structure:
| Column | Description | Type ... | {"source_file": "show.md"} | [
-0.034025486558675766,
0.023421619087457657,
-0.04385829344391823,
0.00911103654652834,
-0.04150088503956795,
-0.0036220818292349577,
0.11003850400447845,
-0.04276791960000992,
-0.026471305638551712,
-0.04988231882452965,
0.06640171259641647,
-0.057600442320108414,
0.15256834030151367,
-0.... |
4e0524a4-1949-4eee-a8bb-6d97c07e8004 | Examples {#examples-4}
In this example we use the
SHOW INDEX
statement to get information about all indexes in table 'tbl'
sql title="Query"
SHOW INDEX FROM 'tbl'
text title="Response"
ββtableββ¬βnon_uniqueββ¬βkey_nameββ¬βseq_in_indexββ¬βcolumn_nameββ¬βcollationββ¬βcardinalityββ¬βsub_partββ¬βpackedββ¬βnullββ¬βindex_typeβ... | {"source_file": "show.md"} | [
0.06496529281139374,
0.004323566798120737,
0.01982767879962921,
0.08611711114645004,
0.006152184680104256,
0.026596184819936752,
0.05673668906092644,
-0.02572113648056984,
-0.011657992377877235,
0.03746625781059265,
0.004690271802246571,
-0.04427013546228409,
0.07661938667297363,
-0.093043... |
c01576f0-3d68-4b30-b30b-7757b6891a91 | Syntax {#syntax-8}
sql title="Syntax"
SHOW CREATE USER [name1 [, name2 ...] | CURRENT_USER]
SHOW CREATE ROLE {#show-create-role}
The
SHOW CREATE ROLE
statement shows parameters which were used at
role creation
.
Syntax {#syntax-9}
sql title="Syntax"
SHOW CREATE ROLE name1 [, name2 ...]
SHOW CREATE ROW PO... | {"source_file": "show.md"} | [
0.02789061889052391,
-0.027308568358421326,
-0.06269876658916473,
0.05433811992406845,
-0.08372457325458527,
0.052709583193063736,
0.09485204517841339,
0.05884735658764839,
-0.14409559965133667,
0.00062949163839221,
-0.009499944746494293,
-0.09496099501848221,
0.1433909386396408,
-0.030885... |
ce06e357-d0f9-416e-90a1-7c0e63da947c | sql title="Syntax"
SHOW ACCESS
SHOW CLUSTER(S) {#show-clusters}
The
SHOW CLUSTER(S)
statement returns a list of clusters.
All available clusters are listed in the
system.clusters
table.
:::note
The
SHOW CLUSTER name
query displays
cluster
,
shard_num
,
replica_num
,
host_name
,
host_address
, and
por... | {"source_file": "show.md"} | [
0.0747913047671318,
-0.03710702061653137,
-0.03393649309873581,
0.07344501465559006,
0.02967187389731407,
0.003291097469627857,
-0.004176150541752577,
-0.03616905212402344,
-0.04244063049554825,
0.007296364288777113,
0.03831186890602112,
-0.07052861899137497,
0.12331676483154297,
-0.052251... |
ef3bc4c9-5b60-4a54-86ef-dd397f0dcf71 | text title="Response"
ββnameββββββββββββββ¬βtypeββββ¬βvalueββββββββ
β max_memory_usage β UInt64 β 10000000000 β
ββββββββββββββββββββ΄βββββββββ΄ββββββββββββββ
SHOW SETTING {#show-setting}
The
SHOW SETTING
statement outputs setting value for specified setting name.
Syntax {#syntax-22}
sql title="Syntax"
SHOW SETTIN... | {"source_file": "show.md"} | [
0.02416970394551754,
0.00026662845630198717,
-0.07940568774938583,
0.058510683476924896,
-0.030690522864460945,
0.0001369450765196234,
0.047264307737350464,
0.08835936337709427,
-0.09614483267068863,
0.017359351739287376,
-0.022060733288526535,
-0.03332754224538803,
0.0677790492773056,
-0.... |
8e3b99e1-8717-423a-af2e-0b70b3b67a1e | sql title="Query"
SHOW MERGES LIKE 'your_t%' LIMIT 1;
text title="Response"
ββtableβββββββ¬βdatabaseββ¬βestimate_completeββ¬βelapsedββ¬βprogressββ¬βis_mutationββ¬βsize_compressedββ¬βmemory_usageββ
β your_table β default β 0.14 β 0.36 β 73.01 β 0 β 5.40 MiB β 10.25 MiB β
ββββββββββββββ΄... | {"source_file": "show.md"} | [
0.023206841200590134,
-0.008321214467287064,
0.017810463905334473,
0.059521421790122986,
-0.07510564476251602,
-0.02039625309407711,
0.08436919748783112,
0.0866900086402893,
0.0031480847392231226,
-0.033128004521131516,
0.07849745452404022,
-0.05112665891647339,
0.05334606394171715,
-0.058... |
8f20ae03-d451-404a-8f52-c02ee4e25383 | description: 'Documentation for TRUNCATE Statements'
sidebar_label: 'TRUNCATE'
sidebar_position: 52
slug: /sql-reference/statements/truncate
title: 'TRUNCATE Statements'
doc_type: 'reference'
TRUNCATE Statements
The
TRUNCATE
statement in ClickHouse is used to quickly remove all data from a table or database whi... | {"source_file": "truncate.md"} | [
0.040567971765995026,
0.06380026787519455,
0.015252448618412018,
0.06936711817979813,
-0.0023866682313382626,
-0.0374671146273613,
0.07721543312072754,
-0.04924500361084938,
-0.007272674702107906,
0.014943747781217098,
0.057027287781238556,
0.023368846625089645,
0.045516807585954666,
-0.12... |
0571b5f1-de35-4bb5-b030-6c8f517718f5 | Removes all data from all tables in a database.
TRUNCATE DATABASE {#truncate-database}
sql
TRUNCATE DATABASE [IF EXISTS] db [ON CLUSTER cluster]
| Parameter | Description |
|----------------------|---------------------------------------------------|
|
IF EXISTS
... | {"source_file": "truncate.md"} | [
0.05612395703792572,
-0.023410281166434288,
-0.013390526175498962,
0.07991541922092438,
-0.013644973747432232,
-0.07506376504898071,
0.07902128994464874,
-0.04664928466081619,
0.0038722555618733168,
0.02841363102197647,
0.09754370152950287,
0.028963850811123848,
0.09204030781984329,
-0.094... |
cdda3378-348e-4952-96ed-205246fd8f12 | description: 'Documentation for EXCHANGE Statement'
sidebar_label: 'EXCHANGE'
sidebar_position: 49
slug: /sql-reference/statements/exchange
title: 'EXCHANGE Statement'
doc_type: 'reference'
EXCHANGE Statement
Exchanges the names of two tables or dictionaries atomically.
This task can also be accomplished with a
... | {"source_file": "exchange.md"} | [
0.016539279371500015,
-0.012530192732810974,
0.005004459526389837,
0.05089081823825836,
-0.05499497801065445,
-0.08028165996074677,
0.10080728679895401,
-0.02358327992260456,
-0.0040387301705777645,
0.026312779635190964,
0.06438622623682022,
-0.05204825475811958,
0.030610527843236923,
-0.0... |
c1078bab-1431-4c04-a279-b50a41fda77f | description: 'Documentation for Detach'
sidebar_label: 'DETACH'
sidebar_position: 43
slug: /sql-reference/statements/detach
title: 'DETACH Statement'
doc_type: 'reference'
Makes the server "forget" about the existence of a table, a materialized view, a dictionary, or a database.
Syntax
sql
DETACH TABLE|VIEW|DIC... | {"source_file": "detach.md"} | [
0.0069803353399038315,
-0.07884971797466278,
-0.02453182265162468,
0.09791646152734756,
0.05156925693154335,
-0.01646801084280014,
0.0178056750446558,
-0.07013550400733948,
0.05061778426170349,
-0.0013488178374245763,
0.11421317607164383,
0.09583988040685654,
0.07643669098615646,
-0.057388... |
cff33d1a-a2fd-46c2-95e0-de42c11d64be | description: 'Documentation for PARALLEL WITH Clause'
sidebar_label: 'PARALLEL WITH'
sidebar_position: 53
slug: /sql-reference/statements/parallel_with
title: 'PARALLEL WITH Clause'
doc_type: 'reference'
PARALLEL WITH Clause
Allows to execute multiple statements in parallel.
Syntax {#syntax}
sql
statement1 PA... | {"source_file": "parallel_with.md"} | [
-0.030657656490802765,
-0.007744107395410538,
-0.021747861057519913,
-0.00007207507587736472,
-0.05475705862045288,
-0.023188680410385132,
-0.04991396516561508,
0.03486863523721695,
-0.022587141022086143,
0.034394778311252594,
0.07417858392000198,
-0.021651098504662514,
0.05678289383649826,
... |
ef4a5528-2592-4038-8704-7771d9f481f3 | description: 'Documentation for Check Table'
sidebar_label: 'CHECK TABLE'
sidebar_position: 41
slug: /sql-reference/statements/check-table
title: 'CHECK TABLE Statement'
doc_type: 'reference'
The
CHECK TABLE
query in ClickHouse is used to perform a validation check on a specific table or its partitions. It ensure... | {"source_file": "check-table.md"} | [
0.032052598893642426,
0.006286249496042728,
-0.03627973794937134,
0.058873604983091354,
0.05363032594323158,
-0.08954688161611557,
0.09893869608640671,
0.052058618515729904,
-0.013943583704531193,
0.04190376400947571,
0.04266798496246338,
0.0198956411331892,
0.0603325217962265,
-0.05205412... |
cac7778e-158e-4493-b800-589d8b768ea6 | Log
TinyLog
StripeLog
MergeTree family
Performed over the tables with another table engines causes an
NOT_IMPLEMENTED
exception.
Engines from the
*Log
family do not provide automatic data recovery on failure. Use the
CHECK TABLE
query to track data loss in a timely manner.
Examples {#examples}
By ... | {"source_file": "check-table.md"} | [
0.06799846887588501,
0.011700941249728203,
0.036049701273441315,
0.05232568457722664,
0.033200595527887344,
-0.03811910003423691,
0.04402003437280655,
0.04735599830746651,
-0.056809645146131516,
0.03980278596282005,
0.025270771235227585,
-0.08114791661500931,
-0.03288545086979866,
-0.00700... |
dad94620-1c5c-4a55-8160-8328976e124d | sql
CHECK ALL TABLES
FORMAT PrettyCompactMonoBlock
SETTINGS check_query_single_value_result = 0
text
ββdatabaseββ¬βtableβββββ¬βpart_pathββββ¬βis_passedββ¬βmessageββ
β default β t2 β all_1_95_3 β 1 β β
β db1 β table_01 β all_39_39_0 β 1 β β
β default β t1 β all_39_39_0 β... | {"source_file": "check-table.md"} | [
-0.008733032271265984,
-0.02744530513882637,
-0.0061845420859754086,
0.027387119829654694,
0.009908665902912617,
-0.047022487968206406,
0.034648995846509933,
-0.013917086645960808,
-0.10712555795907974,
0.06790824979543686,
0.06936315447092056,
-0.04525697976350784,
0.06329430639743805,
-0... |
bb612107-8935-4f06-be26-e4dcd2dbb3f1 | description: 'Documentation for Attach'
sidebar_label: 'ATTACH'
sidebar_position: 40
slug: /sql-reference/statements/attach
title: 'ATTACH Statement'
doc_type: 'reference'
Attaches a table or a dictionary, for example, when moving a database to another server.
Syntax
sql
ATTACH TABLE|DICTIONARY|DATABASE [IF NOT... | {"source_file": "attach.md"} | [
0.04367269575595856,
-0.07731927931308746,
-0.05301695689558983,
0.10545454919338226,
-0.00039785378612577915,
-0.044526975601911545,
0.05640744790434837,
0.00905918050557375,
0.0064026121981441975,
0.03064741939306259,
0.11400628834962845,
0.03228252753615379,
0.11766839772462845,
-0.0323... |
6d83c3ea-cf70-44aa-a41f-edd65f213f74 | If you are trying to add a replica to an existing ReplicatedMergeTree table, keep in mind that all the local data in converted MergeTree table will be detached.
Syntax
sql
ATTACH TABLE [db.]name AS [NOT] REPLICATED
Convert table to replicated
sql
DETACH TABLE test;
ATTACH TABLE test AS REPLICATED;
SYSTEM RESTOR... | {"source_file": "attach.md"} | [
0.0054078176617622375,
-0.06620870530605316,
-0.02219388633966446,
0.0005408228607848287,
-0.009236074984073639,
-0.0898931622505188,
0.0009585358784534037,
-0.03588828817009926,
-0.052407484501600266,
0.10684851557016373,
0.05488266795873642,
-0.07964596897363663,
0.10028739273548126,
-0.... |
5e0e5e04-2076-4a51-b556-249976edf28d | description: 'Documentation for UNDROP TABLE'
sidebar_label: 'UNDROP'
slug: /sql-reference/statements/undrop
title: 'UNDROP TABLE'
doc_type: 'reference'
UNDROP TABLE
Cancels the dropping of the table.
Beginning with ClickHouse version 23.3 it is possible to UNDROP a table in an Atomic database
within
database_... | {"source_file": "undrop.md"} | [
-0.030372200533747673,
-0.079108327627182,
0.0025564918760210276,
0.05756637826561928,
0.0028451019898056984,
-0.05226915702223778,
0.023358669131994247,
-0.03662547841668129,
0.005744471214711666,
0.010208165273070335,
0.07884840667247772,
-0.03452257439494133,
0.05759817734360695,
-0.071... |
7924d52a-742a-421d-9f9d-1b3e5f274c4f | description: 'Documentation for EXECUTE AS Statement'
sidebar_label: 'EXECUTE AS'
sidebar_position: 53
slug: /sql-reference/statements/execute_as
title: 'EXECUTE AS Statement'
doc_type: 'reference'
EXECUTE AS Statement
Allows to execute queries on behalf of a different user.
Syntax {#syntax}
sql
EXECUTE AS ta... | {"source_file": "execute_as.md"} | [
-0.0362730547785759,
-0.016932599246501923,
-0.014233137480914593,
0.035233642905950546,
-0.13865765929222107,
-0.053523220121860504,
0.03844205290079117,
0.0571298748254776,
-0.04084833711385727,
-0.04210582375526428,
-0.02438696101307869,
-0.06712906807661057,
0.10691335797309875,
-0.044... |
f89ace83-cff7-42f6-bee1-94eb1d780107 | description: 'Documentation for Machine Learning Functions'
sidebar_label: 'Machine Learning'
slug: /sql-reference/functions/machine-learning-functions
title: 'Machine Learning Functions'
doc_type: 'reference'
Machine learning functions
evalMLMethod {#evalmlmethod}
Prediction using fitted regression models uses... | {"source_file": "machine-learning-functions.md"} | [
-0.10664293169975281,
-0.05567952245473862,
-0.0449596643447876,
0.041538119316101074,
0.01598476618528366,
-0.005206274800002575,
0.006123299710452557,
-0.007445662748068571,
-0.1092841625213623,
-0.03497990965843201,
0.02388245053589344,
-0.013550154864788055,
0.03883605822920799,
-0.134... |
4473fa76-0a4b-4939-af35-7c74e7ddd463 | Additionally, sample models and their associated config files are available
here
.
Here is an example configuration for a naive Bayes model in ClickHouse:
xml
<clickhouse>
<nb_models>
<model>
<name>sentiment</name>
<path>/etc/clickhouse-server/config.d/sentiment.bin</path>
... | {"source_file": "machine-learning-functions.md"} | [
-0.02168753743171692,
-0.06968186795711517,
-0.044825565069913864,
0.009345421567559242,
-0.013228069059550762,
-0.011494615115225315,
-0.004889016039669514,
-0.009771364741027355,
-0.04910777509212494,
-0.0007026640814729035,
0.04490360617637634,
-0.032802194356918335,
0.06305602192878723,
... |
03f16ed8-a77d-4c1d-85fd-c56c10e7ef28 | text
<class_id> <n-gram> <count>
0 exc 15
1 ref 28
Human-readable format is not used by ClickHouse directly; it must be converted to the binary format described below.
Binary Format Details
Each n-gram stored as:
1. 4-byte
class_id
(UInt, little-endian)
2. 4-byte
n-gram
bytes length (UInt, little-endian)
3. Ra... | {"source_file": "machine-learning-functions.md"} | [
-0.026083583012223244,
-0.041869159787893295,
-0.036297012120485306,
-0.00834049191325903,
-0.0301427710801363,
0.03598916530609131,
0.016346454620361328,
0.005028336774557829,
-0.021816831082105637,
0.003414549631997943,
0.03948861360549927,
-0.03223325312137604,
0.0005321739008650184,
-0... |
947e3fc6-b3f9-4777-ba35-a18b4dcaea33 | description: 'Documentation for Introspection Functions'
sidebar_label: 'Introspection'
slug: /sql-reference/functions/introspection
title: 'Introspection Functions'
doc_type: 'reference'
Introspection functions
You can use functions described in this chapter to introspect
ELF
and
DWARF
for query profiling.
... | {"source_file": "introspection.md"} | [
0.007991966791450977,
0.01501506194472313,
-0.0669582411646843,
0.048745740205049515,
-0.00438925065100193,
-0.10411418974399567,
0.03227027878165245,
0.0686979740858078,
-0.10375314205884933,
-0.012444132007658482,
0.017173796892166138,
-0.07160619646310806,
-0.013862582854926586,
-0.0952... |
8a089c6c-ff70-44a4-aa3f-a74d1dfad639 | SELECT
arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions
FROM system.trace_log
LIMIT 1
\G
```
response title=Response
Row 1:
ββββββ
trace_functions: DB::IAggregateFunctionHelper<DB::AggregateFunctionSum<unsigned long, unsigned long, DB::AggregateFunctionSumData<unsigne... | {"source_file": "introspection.md"} | [
0.009646288119256496,
-0.003577624913305044,
-0.03848889097571373,
0.039266571402549744,
-0.06091153994202614,
-0.02040228061378002,
0.08443237096071243,
-0.010885427705943584,
-0.030484827235341072,
-0.00212694238871336,
0.006964808329939842,
-0.05487857386469841,
-0.015274906530976295,
-... |
5d69e817-d7ad-4039-91d5-d46ba37fe0e2 | Examples
Basic example
sql title=Query
WITH 'all_12_25_7_4' AS lhs, 'all_7_100_10_20' AS rhs
SELECT isMergeTreePartCoveredBy(rhs, lhs), isMergeTreePartCoveredBy(lhs, rhs);
response title=Response
ββisMergeTreePartCoveredBy(rhs, lhs)ββ¬βisMergeTreePartCoveredBy(lhs, rhs)ββ
β 0 β ... | {"source_file": "introspection.md"} | [
0.03349113464355469,
0.00013768469216302037,
0.0521891713142395,
0.04931649565696716,
-0.02160489931702614,
-0.09221044182777405,
0.07335416972637177,
0.03617161884903908,
0.021380510181188583,
0.011817106045782566,
0.009186695329844952,
-0.06371410936117172,
0.001838016789406538,
-0.06593... |
7f02876f-0776-4ada-98b5-4685f5dbf843 | description: 'Documentation for arrayJoin function'
sidebar_label: 'arrayJoin'
slug: /sql-reference/functions/array-join
title: 'arrayJoin function'
doc_type: 'reference'
arrayJoin function
This is a very unusual function.
Normal functions do not change a set of rows, but just change the values in each row (map... | {"source_file": "array-join.md"} | [
-0.010787762701511383,
0.026271313428878784,
-0.0013831183314323425,
0.033422619104385376,
-0.11092997342348099,
0.02122829109430313,
0.04806188493967056,
-0.03992534056305885,
-0.03543199598789215,
-0.010034301318228245,
-0.03420504182577133,
0.017078658565878868,
-0.003785340813919902,
-... |
106ffc30-6e82-4445-bc39-9a7d2dae5318 | Example:
sql
SELECT
arrayJoin(dice) AS first_throw,
/* arrayJoin(dice) as second_throw */ -- is technically correct, but will annihilate result set
arrayJoin(arrayConcat(dice, [])) AS second_throw -- intentionally changed expression to force re-evaluation
FROM (
SELECT [1, 2, 3, 4, 5, 6] AS dice
);
... | {"source_file": "array-join.md"} | [
0.04203331843018532,
-0.027276230975985527,
-0.023901386186480522,
0.051273319870233536,
-0.08346503973007202,
0.0014409320428967476,
0.12009790539741516,
-0.09834498912096024,
-0.07806000113487244,
-0.04790956526994705,
-0.07167913019657135,
-0.015550068579614162,
0.031106488779187202,
-0... |
2f670286-de31-4eac-9587-e3ceb07bb49a | description: 'Documentation for Functions for Searching in Strings'
sidebar_label: 'String search'
slug: /sql-reference/functions/string-search-functions
title: 'Functions for Searching in Strings'
doc_type: 'reference'
Functions for Searching in Strings
All functions in this section search case-sensitively by de... | {"source_file": "string-search-functions.md"} | [
-0.048609521239995956,
0.009388115257024765,
0.043351758271455765,
0.010425593703985214,
-0.06271812319755554,
-0.02169616147875786,
0.04135260358452797,
0.040499914437532425,
-0.014703950844705105,
-0.06069750338792801,
0.05032828822731972,
0.004494879860430956,
0.09964679181575775,
-0.00... |
f3e991dc-9b0c-4f04-8b12-1709b2a40e63 | pattern
β Regular expression pattern.
const String
Returned value
Returns the number of matches found.
UInt64
Examples
Case insensitive count
sql title=Query
SELECT countMatchesCaseInsensitive('Hello HELLO world', 'hello')
response title=Response
ββcountMatchesCaseInsensitive('Hello HELLO world', 'hell... | {"source_file": "string-search-functions.md"} | [
0.013184089213609695,
-0.03432334586977959,
0.0036528136115521193,
0.038984715938568115,
-0.09755318611860275,
0.030225781723856926,
0.04427157714962959,
0.0710507407784462,
-0.014792685396969318,
-0.02949737384915352,
0.02566014975309372,
-0.016380013898015022,
0.09723343700170517,
-0.060... |
799b3b55-298d-4398-bedf-f8a89b70ee9e | start_pos
β Optional. Position (1-based) in
haystack
at which the search starts.
UInt*
Returned value
Returns the number of occurrences of the needle in the haystack.
UInt64
Examples
Usage example
sql title=Query
SELECT countSubstringsCaseInsensitiveUTF8('Π»ΠΎΠΆΠΊΠ°, ΠΊΠΎΡΠΊΠ°, ΠΊΠ°ΡΡΠΎΡΠΊΠ°', 'ΠΠ');
response titl... | {"source_file": "string-search-functions.md"} | [
-0.013385084457695484,
0.02649032510817051,
0.01335521787405014,
0.030499370768666267,
-0.01943165436387062,
0.054707374423742294,
0.06035357341170311,
0.0175657719373703,
0.027401093393564224,
-0.06475602090358734,
-0.0032157187815755606,
-0.027592675760388374,
0.0414629802107811,
-0.0689... |
c68abd11-1bd5-471c-970b-0368d0dd0d02 | Extract using capturing group
sql title=Query
SELECT extractAll('test@example.com, user@domain.org', '([a-zA-Z0-9]+)@')
response title=Response
ββextractAll('test@example.com, user@domain.org', '([a-zA-Z0-9]+)@')ββ
β ['test','user'] β
ββββββββββββββββββββββββββββββ... | {"source_file": "string-search-functions.md"} | [
-0.01766580156981945,
0.02342037670314312,
0.030880074948072433,
0.06733550131320953,
0.03916221484541893,
-0.005615190137177706,
0.08307668566703796,
-0.059117160737514496,
-0.023987671360373497,
-0.04032910615205765,
-0.010465915314853191,
-0.014724140986800194,
0.039464764297008514,
-0.... |
725fd573-de1b-413c-b98c-a825918421a2 | Like
hasAnyTokens
, but returns 1, if all tokens in the
needle
string or array match the
input
string, and 0 otherwise. If
input
is a column, returns all rows that satisfy this condition.
:::note
Column
input
should have a
text index
defined for optimal performance.
If no text index is defined, the functio... | {"source_file": "string-search-functions.md"} | [
0.0022167828865349293,
0.01077660545706749,
-0.030603284016251564,
0.013578344136476517,
-0.08012739568948746,
0.00034943135688081384,
0.0973675400018692,
0.018574753776192665,
-0.039334334433078766,
0.018407320603728294,
-0.003849343629553914,
0.011466843076050282,
0.06769777834415436,
-0... |
b67d8371-9871-44aa-b946-43f2564da348 | ```
Example with an array column
sql title=Query
SELECT count() FROM log WHERE hasAllTokens(tags, 'clickhouse');
response title=Response
ββcount()ββ
β 1 β
βββββββββββ
Example with mapKeys
sql title=Query
SELECT count() FROM log WHERE hasAllTokens(mapKeys(attributes), ['address', 'log_level']);
respons... | {"source_file": "string-search-functions.md"} | [
0.04208816960453987,
0.006652913987636566,
-0.01419549435377121,
0.037170957773923874,
-0.053053002804517746,
-0.03946954384446144,
0.0881086066365242,
-0.001424463465809822,
0.009050861932337284,
0.008651675656437874,
0.03199733421206474,
-0.04003213346004486,
0.1002156063914299,
-0.10199... |
10e964a3-5ad4-4f0b-9a8d-fa9427538c60 | response title=Response
ββcount()ββ
β 3 β
βββββββββββ
Usage examples for array and map columns
```sql title=Query
CREATE TABLE log (
id UInt32,
tags Array(String),
attributes Map(String, String),
INDEX idx_tags (tags) TYPE text(tokenizer = splitByNonAlpha),
INDEX idx_attributes_keys mapKey... | {"source_file": "string-search-functions.md"} | [
0.09784103184938431,
0.05176147446036339,
0.02379509061574936,
0.04292067885398865,
-0.06738274544477463,
-0.045900288969278336,
0.08831073343753815,
-0.003359483554959297,
0.00769758177921176,
0.005641532596200705,
0.0528191439807415,
-0.06233321130275726,
0.09365823864936829,
-0.07761996... |
d2592897-f258-45e2-b9fc-5fa3b75893bc | Returned value
Returns 1, if needle is a subsequence of haystack, 0 otherwise.
UInt8
Examples
Usage example
sql title=Query
SELECT hasSubsequenceCaseInsensitive('garbage', 'ARG');
response title=Response
ββhasSubsequenceCaseInsensitive('garbage', 'ARG')ββ
β 1 β
β... | {"source_file": "string-search-functions.md"} | [
-0.04682248830795288,
-0.043128687888383865,
0.004555027931928635,
0.028872547671198845,
-0.09819311648607254,
-0.0106408866122365,
0.06420674920082092,
0.03655456751585007,
-0.05231630429625511,
-0.06435190886259079,
-0.016042323783040047,
-0.06984219700098038,
0.09315796941518784,
-0.037... |
a84fc4ab-9bc6-4c5a-a6b6-a034eebbd96d | Syntax
```sql
```
Arguments
None.
Returned value
Examples
hasTokenCaseInsensitiveOrNull {#hasTokenCaseInsensitiveOrNull}
Introduced in: v
Performs case insensitive lookup of needle in haystack using tokenbf_v1 index. Returns null if needle is ill-formed.
Syntax
```sql
```
Arguments
Non... | {"source_file": "string-search-functions.md"} | [
-0.03132020682096481,
-0.005682704504579306,
0.03272438421845436,
0.03511098027229309,
-0.03203672170639038,
0.025726936757564545,
0.025439729914069176,
0.053917817771434784,
-0.085848368704319,
0.0024475085083395243,
0.04292718693614006,
-0.0844738781452179,
0.06465435773134232,
-0.056945... |
23989e76-4075-4aca-a318-93fd01a17d26 | Syntax
sql
like(haystack, pattern)
-- haystack LIKE pattern
Arguments
haystack
β String in which the search is performed.
String
or
FixedString
pattern
β
LIKE
pattern to match against. Can contain
%
(matches any number of characters),
_
(matches single character), and
\
for escaping.
String
... | {"source_file": "string-search-functions.md"} | [
-0.045052431523799896,
-0.040771037340164185,
0.07542204856872559,
0.051933709532022476,
-0.046120788902044296,
-0.01708349958062172,
0.039498090744018555,
-0.03801489248871803,
-0.015698062255978584,
-0.03275559842586517,
0.0891919657588005,
-0.021326059475541115,
0.08363129198551178,
-0.... |
05213221-d30a-4dbc-b13f-5378525a287e | The pattern is automatically anchored at both ends (as if the pattern started with '^' and ended with '$').
If you only like to find substrings, you can use functions
like
or
position
instead - they work much faster than this function.
Alternative operator syntax:
haystack REGEXP pattern
.
Syntax
sql
match... | {"source_file": "string-search-functions.md"} | [
-0.05850881710648537,
0.006050532683730125,
0.06757212430238724,
0.022541549056768417,
-0.03261775150895119,
-0.06467028707265854,
0.027754027396440506,
-0.04441514611244202,
-0.009457527659833431,
-0.018139205873012543,
-0.003333383472636342,
-0.035634785890579224,
0.013637731783092022,
-... |
49486d4e-4a13-433a-9d14-037c40becfb6 | distance
β The maximum edit distance for fuzzy matching.
UInt8
pattern
β Optional. An array of patterns to match against.
Array(String)
Returned value
Returns
1
if any pattern matches the haystack within the specified edit distance, otherwise
0
.
UInt8
Examples
Usage example
sql title=Query
SELECT... | {"source_file": "string-search-functions.md"} | [
-0.04012593999505043,
-0.051153820008039474,
-0.0269731804728508,
-0.029126793146133423,
-0.09929332137107849,
0.010471667163074017,
-0.0017675544368103147,
0.010967622511088848,
-0.05481046810746193,
-0.03616277128458023,
-0.004575215745717287,
-0.0561961866915226,
0.0503346286714077,
-0.... |
99a7a521-26b8-45a0-91a4-d323d3e36d8a | Returned value
Returns
1
if any pattern matches,
0
otherwise.
UInt8
Examples
Multiple pattern matching
sql title=Query
SELECT multiMatchAny('Hello World', ['Hello.*', 'foo.*'])
response title=Response
ββmultiMatchAny('Hello World', ['Hello.*', 'foo.*'])ββ
β ... | {"source_file": "string-search-functions.md"} | [
-0.043701354414224625,
-0.026445994153618813,
0.04441019520163536,
0.0055723912082612514,
-0.04365259036421776,
-0.06125730276107788,
0.052780881524086,
-0.04057068005204201,
-0.039435457438230515,
-0.022380471229553223,
0.009341385215520859,
-0.09056191146373749,
0.04055078327655792,
-0.0... |
d055f570-763f-479c-b3d6-8448dd1f4410 | Arguments
haystack
β String in which the search is performed.
String
needle1[, needle2, ...]
β An array of one or more substrings to be searched.
Array(String)
Returned value
Returns array of the starting position in bytes and counting from 1 (if the substring was found),
0
if the substring was not fo... | {"source_file": "string-search-functions.md"} | [
0.029795004054903984,
-0.034997887909412384,
0.02879980020225048,
-0.01679445244371891,
-0.05298503115773201,
-0.028039587661623955,
0.03606598079204559,
0.0043239169754087925,
-0.044314317405223846,
-0.016561053693294525,
-0.011237862519919872,
-0.03178829327225685,
0.09978239983320236,
-... |
ce4e8b83-e059-4a85-b4bf-130cfc23863f | Arguments
haystack
β String in which the search is performed.
String
needle1[, needle2, ...]
β An array of substrings to be searched.
Array(String)
Returned value
Returns
1
, if there was at least one match, otherwise
0
, if there was not at least one match.
UInt8
Examples
Any match search
sql ... | {"source_file": "string-search-functions.md"} | [
0.0023544616997241974,
-0.026531167328357697,
0.004001914989203215,
0.006279596593230963,
-0.035664163529872894,
-0.023097502067685127,
0.029310772195458412,
-0.018984723836183548,
-0.06470612436532974,
-0.06330736726522446,
-0.0013411248801276088,
-0.0894128754734993,
0.09135119616985321,
... |
2e78ec0a-a047-403a-b906-76442841848a | Examples
Given 'δ½ ε₯½οΌδΈη' ('Hello, world') as a UTF-8 string, check if there are any δ½ or η characters in the string
sql title=Query
SELECT multiSearchAnyUTF8('δ½ ε₯½οΌδΈη', ['δ½ ', 'η'])
response title=Response
ββmultiSearchAβ―δ½ ', 'η'])ββ
β 1 β
ββββββββββββββββββββββββββββ
multiSearchFirstIndex {#mu... | {"source_file": "string-search-functions.md"} | [
0.0079237325116992,
-0.03985562175512314,
0.05445386469364166,
0.0067724063992500305,
-0.024387024343013763,
0.007247339468449354,
0.039996858686208725,
-0.0349210649728775,
0.006578734610229731,
-0.036243587732315063,
0.06690146774053574,
-0.04443629831075668,
0.12733401358127594,
-0.0348... |
bc77adab-00f2-4035-a7dd-263dd53dfaea | Arguments
haystack
β The string to search in.
String
needles
β Array of strings to search for.
Array(String)
Returned value
Returns the 1-based index (position in the needles array) of the first needle found in the haystack. Returns 0 if no needles are found. The search is case-insensitive and respects ... | {"source_file": "string-search-functions.md"} | [
0.030156167224049568,
-0.020786525681614876,
-0.010423661209642887,
0.020944323390722275,
-0.08179737627506256,
-0.02196994237601757,
0.0278458371758461,
-0.026692448183894157,
-0.014766042120754719,
-0.04515629634261131,
0.033112477511167526,
-0.0364055372774601,
0.08470603823661804,
-0.0... |
5fa6aaa8-9343-4d95-9c54-8c4b1f428f53 | Examples
First position search
sql title=Query
SELECT multiSearchFirstPosition('Hello World',['llo', 'Wor', 'ld'])
response title=Response
ββmultiSearchFirstPosition('Hello World', ['llo', 'Wor', 'ld'])ββ
β 3 β
βββββββββββββββββββββββββββββββββββββββββββ... | {"source_file": "string-search-functions.md"} | [
0.02311423420906067,
-0.03563643991947174,
0.053575195372104645,
-0.013898217119276524,
-0.0631515383720398,
-0.03831371292471886,
-0.00025203771656379104,
0.018838614225387573,
-0.06163022294640541,
-0.03523372486233711,
0.05841771885752678,
-0.039465826004743576,
0.07608703523874283,
-0.... |
07494472-bd07-4169-aeb5-741cd105caed | Arguments
haystack
β UTF-8 string in which the search is performed.
String
needle
β Array of UTF-8 substrings to be searched.
Array(String)
Returned value
Leftmost offset in a
haystack
string which matches any of multiple
needle
strings. Returns
0
, if there was no match.
UInt64
Examples
Find ... | {"source_file": "string-search-functions.md"} | [
0.015699179843068123,
-0.028553977608680725,
-0.021183796226978302,
-0.05849307402968407,
-0.06455180794000626,
-0.0014446749119088054,
0.03711329773068428,
0.03965715318918228,
0.004373552743345499,
-0.01945209689438343,
0.02190888114273548,
-0.05584574490785599,
0.049746815115213394,
-0.... |
978de5a8-739d-44a4-b9a2-7a9eac76648f | ngramDistanceCaseInsensitiveUTF8 {#ngramDistanceCaseInsensitiveUTF8}
Introduced in: v20.1
Provides a case-insensitive UTF-8 variant of
ngramDistance
.
Assumes that
needle
and
haystack
strings are UTF-8 encoded strings and ignores case.
Calculates the 3-gram distance between two UTF-8 strings, ignoring case.
Th... | {"source_file": "string-search-functions.md"} | [
-0.03446608781814575,
-0.03740730136632919,
-0.004206659272313118,
-0.025361623615026474,
-0.07693025469779968,
-0.003994326572865248,
0.0240531824529171,
0.07051090896129608,
-0.0553617887198925,
-0.010751128196716309,
0.022432927042245865,
-0.08743096888065338,
0.037834811955690384,
0.02... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.