id stringlengths 36 36 | document stringlengths 3 3k | metadata stringlengths 23 69 | embeddings listlengths 384 384 |
|---|---|---|---|
c351b5ed-9eb6-4974-ac93-4614b07f8ffc | The query
sql
SELECT a, b, toTypeName(a), toTypeName(b) FROM t_1 FULL JOIN t_2 USING (a, b);
returns the set:
response
┌──a─┬────b─┬─toTypeName(a)─┬─toTypeName(b)───┐
│ 1 │ 1 │ Int32 │ Nullable(Int64) │
│ 2 │ 2 │ Int32 │ Nullable(Int64) │
│ -1 │ 1 │ Int32 │ Nullable(Int64) │
│ 1 │... | {"source_file": "join.md"} | [
-0.008784365840256214,
-0.04035785049200058,
-0.020550090819597244,
0.08264073729515076,
-0.09336110204458237,
-0.04259959235787392,
0.06564600765705109,
0.01731668971478939,
-0.0393156036734581,
-0.037490371614694595,
0.05568762496113777,
-0.08261734247207642,
0.0932924821972847,
-0.12563... |
716f9b16-2ab4-406c-866d-b680569783b5 | Memory limitations {#memory-limitations}
By default, ClickHouse uses the
hash join
algorithm. ClickHouse takes the right_table and creates a hash table for it in RAM. If
join_algorithm = 'auto'
is enabled, then after some threshold of memory consumption, ClickHouse falls back to
merge
join algorithm. For
JOIN
... | {"source_file": "join.md"} | [
0.029315520077943802,
-0.0608149990439415,
-0.07319813966751099,
0.026764461770653725,
-0.07069191336631775,
-0.04427918419241905,
0.0333620086312294,
0.013334372080862522,
-0.02276736870408058,
-0.010494108311831951,
-0.02088627591729164,
0.08928760141134262,
0.02988671138882637,
-0.07839... |
45886fbe-81f0-4da1-af9a-89b94b86e616 | description: 'Documentation for Offset'
sidebar_label: 'OFFSET'
slug: /sql-reference/statements/select/offset
title: 'OFFSET FETCH Clause'
doc_type: 'reference'
OFFSET
and
FETCH
allow you to retrieve data by portions. They specify a row block which you want to get by a single query.
sql
OFFSET offset_row_count... | {"source_file": "offset.md"} | [
-0.07526256889104843,
0.017710335552692413,
-0.006427221931517124,
0.028699606657028198,
-0.08440059423446655,
0.06074470654129982,
0.004222464747726917,
0.03483225032687187,
-0.00546899251639843,
-0.03801190108060837,
0.024951433762907982,
-0.007582681253552437,
0.08305441588163376,
-0.14... |
720fd9e6-7ef4-41e3-8015-27b06645d225 | description: 'Documentation for ALL Clause'
sidebar_label: 'ALL'
slug: /sql-reference/statements/select/all
title: 'ALL Clause'
doc_type: 'reference'
ALL Clause
If there are multiple matching rows in a table, then
ALL
returns all of them.
SELECT ALL
is identical to
SELECT
without
DISTINCT
. If both
ALL
a... | {"source_file": "all.md"} | [
0.004618600010871887,
0.028025437146425247,
0.02632853202521801,
-0.010546890087425709,
0.01301640272140503,
0.044958069920539856,
0.03773960843682289,
0.0448341965675354,
-0.006615877617150545,
0.0098563926294446,
0.04709569737315178,
0.0018779461970552802,
0.05304460600018501,
-0.1201692... |
69e3d5af-b06a-4fac-939e-543d63bdc10c | description: 'Documentation for LIMIT Clause'
sidebar_label: 'LIMIT'
slug: /sql-reference/statements/select/limit
title: 'LIMIT Clause'
doc_type: 'reference'
LIMIT Clause
LIMIT m
allows to select the first
m
rows from the result.
LIMIT n, m
allows to select the
m
rows from the result after skipping the fi... | {"source_file": "limit.md"} | [
-0.04249006137251854,
0.027530260384082794,
-0.012361898086965084,
-0.0015016988618299365,
-0.014744610525667667,
0.027263522148132324,
0.03587237000465393,
0.014568528160452843,
-0.013653897680342197,
0.001977107021957636,
0.06230803206562996,
-0.005901239346712828,
0.06621843576431274,
-... |
21767815-3a18-4777-945a-81fe4e134295 | description: 'Documentation for INTO OUTFILE Clause'
sidebar_label: 'INTO OUTFILE'
slug: /sql-reference/statements/select/into-outfile
title: 'INTO OUTFILE Clause'
doc_type: 'reference'
INTO OUTFILE Clause
INTO OUTFILE
clause redirects the result of a
SELECT
query to a file on the
client
side.
Compressed f... | {"source_file": "into-outfile.md"} | [
-0.04119221493601799,
0.06014472246170044,
-0.06386616080999374,
0.09938912093639374,
0.0012477290583774447,
-0.0359979011118412,
0.08136623352766037,
0.09527097642421722,
-0.05022922530770302,
0.04305867850780487,
-0.036038365215063095,
0.0559079647064209,
0.10425689071416855,
-0.09660275... |
c463af50-3906-4b1a-ab77-ef80d66bf2b9 | description: 'Documentation for the
WHERE
clause in ClickHouse'
sidebar_label: 'WHERE'
slug: /sql-reference/statements/select/where
title: 'WHERE clause'
doc_type: 'reference'
keywords: ['WHERE']
WHERE clause
The
WHERE
clause allows you to filter the data that comes from the
FROM
clause of
SELECT
.
If the... | {"source_file": "where.md"} | [
0.0039731222204864025,
0.04995010793209076,
0.01010546088218689,
0.053998593240976334,
0.0141212223097682,
0.07968350499868393,
0.04996803402900696,
-0.035230059176683426,
-0.07798269391059875,
0.007412610109895468,
0.04122010990977287,
0.013767078518867493,
0.04272620379924774,
-0.0609521... |
c0d6005d-a350-4b1d-b2b2-3a0be436745f | Using comparison operators {#using-comparison-operators}
The following
comparison operators
can be used:
| Operator | Function | Description | Example |
|----------|----------|-------------|---------|
|
a = b
|
equals(a, b)
| Equal to |
price = 100
|
|
a == b
|
equals(a, b)
| Equal to (alternative synta... | {"source_file": "where.md"} | [
0.03908153250813484,
0.09690646082162857,
-0.019223526120185852,
-0.07415644079446793,
-0.06045132875442505,
-0.0029820341151207685,
-0.03364735096693039,
0.040713243186473846,
-0.005082267336547375,
0.0032627924811095,
0.01706857979297638,
-0.10844512283802032,
0.13146527111530304,
0.0161... |
cdb00f79-4522-4387-818a-f49fb8167426 | The expression following the
WHERE
clause can also include
literals
, columns or subqueries, which are nested
SELECT
statements that return values used in conditions.
| Type | Definition | Evaluation | Performance | Example |
|------|------------|------------|-------------|---------|
|
Literal
| Fixed constant... | {"source_file": "where.md"} | [
-0.009480496868491173,
0.05978642404079437,
-0.003109187353402376,
0.07939650863409042,
-0.016176383942365646,
0.01718948967754841,
0.034758731722831726,
0.049002375453710556,
-0.019318804144859314,
0.00003988404569099657,
0.03031536377966404,
-0.03252413123846054,
0.0619647353887558,
-0.0... |
f701663b-8ab6-43a1-875e-d8cda80542b8 | 3.
NOT
- Negates a condition:
sql
SELECT * FROM products
WHERE NOT in_stock;
response
┌─id─┬─name─┬─price─┬─category──┬─in_stock─┐
1. │ 3 │ Desk │ 299 │ Furniture │ false │
2. │ 6 │ Lamp │ 45 │ Furniture │ false │
└────┴──────┴───────┴───────────┴──────────┘
4.
XOR
- Exactly one condition m... | {"source_file": "where.md"} | [
-0.0014573283260688186,
0.01085312943905592,
0.05251886323094368,
-0.024110985919833183,
0.041942283511161804,
-0.07559161633253098,
0.08054770529270172,
-0.0036508790217339993,
0.007021572906523943,
-0.01982922852039337,
0.10727518796920776,
-0.07413019984960556,
0.07858742028474808,
-0.0... |
cda458e5-f408-44f9-a88e-2880ad804f15 | 4. Greater than:
sql
SELECT * FROM products
WHERE in_stock > 0;
5. Less than or equal:
sql
SELECT * FROM products
WHERE in_stock <= 0;
6. Combining with other conditions:
sql
SELECT * FROM products
WHERE in_stock AND price < 400;
7. Using the
IN
operator:
In the example below
(1, true)
is a
tuple
.
... | {"source_file": "where.md"} | [
-0.005649914033710957,
0.07291329652070999,
0.042801011353731155,
0.0023204341996461153,
-0.006114506628364325,
0.003189041744917631,
0.06247856840491295,
0.05933738499879837,
-0.060024309903383255,
-0.030683455988764763,
0.04666336998343468,
-0.028513753786683083,
0.10212962329387665,
-0.... |
6c91022f-b130-4850-b2ce-3fadfc511b71 | description: 'Documentation for CREATE VIEW'
sidebar_label: 'VIEW'
sidebar_position: 37
slug: /sql-reference/statements/create/view
title: 'CREATE VIEW'
doc_type: 'reference'
import ExperimentalBadge from '@theme/badges/ExperimentalBadge';
import DeprecatedBadge from '@theme/badges/DeprecatedBadge';
import CloudNot... | {"source_file": "view.md"} | [
-0.011275812052190304,
-0.07100659608840942,
-0.05459878593683243,
0.08209623396396637,
0.0006558598252013326,
0.04633123055100441,
0.0186771247535944,
-0.04880235344171524,
0.012310037389397621,
0.031103916466236115,
0.028167061507701874,
-0.026609687134623528,
0.09085480123758316,
-0.021... |
abff04b9-44bf-4078-b389-d7278382e94a | :::note
Materialized views in ClickHouse use
column names
instead of column order during insertion into destination table. If some column names are not present in the
SELECT
query result, ClickHouse uses a default value, even if the column is not
Nullable
. A safe practice would be to add aliases for every column ... | {"source_file": "view.md"} | [
-0.04887180030345917,
-0.10589849203824997,
-0.035301029682159424,
0.06641272455453873,
-0.015991684049367905,
-0.04527977108955383,
-0.023334739729762077,
-0.07713228464126587,
0.018427670001983643,
0.009467185474932194,
0.08521854132413864,
-0.0320708304643631,
0.05916125699877739,
-0.07... |
ddd45efd-b8b1-4967-81b8-0b66f2968308 | Note that materialized view is influenced by
optimize_on_insert
setting. The data is merged before the insertion into a view.
Views look the same as normal tables. For example, they are listed in the result of the
SHOW TABLES
query.
To delete a view, use
DROP VIEW
. Although
DROP TABLE
works for VIEWs as wel... | {"source_file": "view.md"} | [
-0.02527414821088314,
-0.08394120633602142,
-0.11896853893995285,
0.041398607194423676,
-0.04275213181972504,
0.008398747071623802,
0.039379868656396866,
-0.0600067600607872,
-0.0200966689735651,
0.013431892730295658,
0.03996444493532181,
-0.02282724715769291,
0.06969413161277771,
-0.03452... |
9e445d13-2100-4c71-94ee-cd675389e83e | Examples {#examples}
sql
CREATE VIEW test_view
DEFINER = alice SQL SECURITY DEFINER
AS SELECT ...
sql
CREATE VIEW test_view
SQL SECURITY INVOKER
AS SELECT ...
Live View {#live-view}
This feature is deprecated and will be removed in the future.
For your convenience, the old documentation is located
here
R... | {"source_file": "view.md"} | [
-0.06609680503606796,
-0.08673928678035736,
-0.11530402302742004,
0.09039624780416489,
-0.025402534753084183,
0.010346143506467342,
0.044229693710803986,
-0.056174859404563904,
-0.03223534673452377,
0.025836709886789322,
0.026127560064196587,
-0.03159118443727493,
0.08346115052700043,
-0.0... |
5f5c9cf9-b267-4756-9a2d-61ae6c4c2429 | RANDOMIZE FOR
randomly adjusts the time of each refresh, e.g.:
sql
REFRESH EVERY 1 DAY OFFSET 2 HOUR RANDOMIZE FOR 1 HOUR -- every day at random time between 01:30 and 02:30
At most one refresh may be running at a time, for a given view. E.g. if a view with
REFRESH EVERY 1 MINUTE
takes 2 minutes to refresh, it'll... | {"source_file": "view.md"} | [
-0.06732496619224548,
-0.08201943337917328,
0.004432999528944492,
0.06606107205152512,
-0.001694590668193996,
-0.05573906749486923,
0.023076293990015984,
-0.11397650837898254,
0.04342120885848999,
0.061617009341716766,
-0.033136144280433655,
0.01097660232335329,
0.08052489161491394,
-0.055... |
cd4cb1f8-468e-4bfb-896a-89505004da2f | A few more examples:
*
REFRESH EVERY 1 DAY OFFSET 10 MINUTE
(
destination
) depends on
REFRESH EVERY 1 DAY
(
source
)
If
source
refresh takes more than 10 minutes,
destination
will wait for it.
*
REFRESH EVERY 1 DAY OFFSET 1 HOUR
depends on
REFRESH EVERY 1 DAY OFFSET 23 HOUR
Similar to the above, even ... | {"source_file": "view.md"} | [
-0.044372379779815674,
-0.06876257807016373,
0.03913737088441849,
0.018540609627962112,
0.04140826314687729,
-0.05213251709938049,
0.016438495367765427,
-0.05511569604277611,
0.06299351155757904,
-0.027996528893709183,
0.025358939543366432,
-0.038045573979616165,
0.015176501125097275,
-0.0... |
230c4100-b52e-492f-be7f-7caea02d6682 | To wait for a refresh to complete, use
SYSTEM WAIT VIEW
. In particular, useful for waiting for initial refresh after creating a view.
:::note
Fun fact: the refresh query is allowed to read from the view that's being refreshed, seeing pre-refresh version of the data. This means you can implement Conway's game of lif... | {"source_file": "view.md"} | [
-0.03753262758255005,
-0.06280414015054703,
-0.044092874974012375,
0.04163168743252754,
0.02528822235763073,
0.017972059547901154,
-0.01577834039926529,
-0.02948339842259884,
0.010136102326214314,
0.01362432911992073,
-0.009934071451425552,
-0.03319842740893364,
-0.05580994859337807,
-0.04... |
0658e31d-9948-4625-8efd-f6706bbe5a2d | Window view provides three watermark strategies:
STRICTLY_ASCENDING
: Emits a watermark of the maximum observed timestamp so far. Rows that have a timestamp smaller to the max timestamp are not late.
ASCENDING
: Emits a watermark of the maximum observed timestamp so far minus 1. Rows that have a timestamp equal a... | {"source_file": "view.md"} | [
-0.029525551944971085,
-0.04401792585849762,
0.05006019026041031,
0.047774601727724075,
0.048296961933374405,
0.015401901677250862,
0.05055626481771469,
-0.01407712697982788,
0.058598797768354416,
-0.06291066110134125,
-0.04585840180516243,
-0.045926533639431,
0.03005482815206051,
0.017031... |
a8a11503-52a5-46a1-94a3-4fbcce75bddf | window_view_heartbeat_interval
: The heartbeat interval in seconds to indicate the watch query is alive.
wait_for_window_view_fire_signal_timeout
: Timeout for waiting for window view fire signal in event time processing.
Example {#example}
Suppose we need to count the number of click logs per 10 seconds in a l... | {"source_file": "view.md"} | [
-0.0003822658909484744,
-0.041829876601696014,
-0.06478459388017654,
0.08795859664678574,
-0.0165354385972023,
0.04965895786881447,
0.06219717860221863,
-0.037523236125707626,
0.08309406042098999,
-0.07144427299499512,
0.02619120664894581,
-0.06408696621656418,
0.03297477960586548,
-0.0342... |
7dd6888c-e2c0-464a-b72a-aab6ac277563 | Logical object (no storage)
A temporary view stores only its
SELECT
text (uses the
View
storage internally). It does not persist data and cannot accept
INSERT
.
Engine clause
You do
not
need to specify
ENGINE
; if provided as
ENGINE = View
, it’s ignored/treated as the same logical view.
Secu... | {"source_file": "view.md"} | [
-0.030613409355282784,
-0.02981446124613285,
-0.08105028420686722,
0.08024485409259796,
-0.019723279401659966,
-0.019769888371229172,
0.05621509999036789,
-0.027871062979102135,
0.031087961047887802,
0.013884265907108784,
0.04353606328368187,
-0.08663138002157211,
0.06348035484552383,
-0.0... |
d84e5d30-a45d-44b6-80ad-f7c9163d122f | description: 'Documentation for Function'
sidebar_label: 'FUNCTION'
sidebar_position: 38
slug: /sql-reference/statements/create/function
title: 'CREATE FUNCTION -user defined function (UDF)'
doc_type: 'reference'
Creates a user defined function (UDF) from a lambda expression. The expression must consist of function... | {"source_file": "function.md"} | [
-0.05214717984199524,
-0.0600384846329689,
-0.05744374915957451,
-0.00331559544429183,
-0.09781736135482788,
0.009995276108384132,
0.030322255566716194,
0.05622907727956772,
-0.04457511007785797,
0.011272406205534935,
0.04516379162669182,
-0.03380921110510826,
0.05526909604668617,
-0.07060... |
884e23a7-4d29-4688-81ea-eca7940fe82f | description: 'Documentation for Table'
keywords: ['compression', 'codec', 'schema', 'DDL']
sidebar_label: 'TABLE'
sidebar_position: 36
slug: /sql-reference/statements/create/table
title: 'CREATE TABLE'
doc_type: 'reference'
import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge';
import Tabs from ... | {"source_file": "table.md"} | [
-0.017364641651511192,
-0.09834102541208267,
-0.05207038298249245,
0.06355144083499908,
-0.00832346361130476,
-0.004151162225753069,
0.008045288734138012,
0.005916711408644915,
-0.01676032692193985,
0.08008196949958801,
0.012305112555623055,
-0.027974572032690048,
0.11218979209661484,
-0.0... |
365195b5-b5cf-4977-9da1-f002486d78c2 | From a Table Function {#from-a-table-function}
sql
CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function()
Creates a table with the same result as that of the
table function
specified. The created table will also work in the same way as the corresponding table function that was specified.
From SELECT q... | {"source_file": "table.md"} | [
-0.03657476231455803,
-0.06583607196807861,
-0.049144722521305084,
0.08061046898365021,
-0.05719055235385895,
-0.07008954137563705,
0.07941337674856186,
0.034008391201496124,
-0.0384511835873127,
-0.02078159898519516,
0.030752260237932205,
-0.04695557430386543,
0.08095061779022217,
-0.0935... |
8236bf13-b18a-494a-b51e-bc349ff4d7c1 | DEFAULT {#default}
DEFAULT expr
Normal default value. If the value of such a column is not specified in an INSERT query, it is computed from
expr
.
Example:
```sql
CREATE OR REPLACE TABLE test
(
id UInt64,
updated_at DateTime DEFAULT now(),
updated_at_date Date DEFAULT toDate(updated_at)
)
ENGINE =... | {"source_file": "table.md"} | [
-0.03726488724350929,
-0.023470215499401093,
-0.03749523311853409,
0.049903709441423416,
-0.06046412140130997,
-0.044466763734817505,
-0.057773422449827194,
0.05730011314153671,
0.05510520190000534,
0.0676565021276474,
0.09685437381267548,
-0.012962374836206436,
-0.03102417103946209,
-0.07... |
4640c759-a327-453e-8129-8d5e49aca2ae | ALIAS {#alias}
ALIAS expr
Calculated columns (synonym). Column of this type are not stored in the table and it is not possible to INSERT values into them.
When SELECT queries explicitly reference columns of this type, the value is computed at query time from
expr
. By default,
SELECT *
excludes ALIAS columns. ... | {"source_file": "table.md"} | [
-0.02983211539685726,
-0.04061385989189148,
-0.009546487592160702,
0.04047205299139023,
-0.040361903607845306,
-0.07568612694740295,
0.01830575428903103,
0.07911700755357742,
0.051163263618946075,
0.07387570291757584,
0.09574680030345917,
0.0108187822625041,
0.008602889254689217,
-0.034971... |
8e47490a-ba40-4024-ae25-513e63ec5713 | Adding large amount of constraints can negatively affect performance of big
INSERT
queries.
ASSUME {#assume}
The
ASSUME
clause is used to define a
CONSTRAINT
on a table that is assumed to be true. This constraint can then be used by the optimizer to enhance the performance of SQL queries.
Take this example ... | {"source_file": "table.md"} | [
-0.017252681776881218,
0.015161819756031036,
0.009345929138362408,
0.01618567854166031,
-0.06582175195217133,
-0.02250504493713379,
-0.02027175948023796,
0.03446899726986885,
-0.007931212894618511,
0.021778959780931473,
0.06026932969689369,
-0.017942063510417938,
0.0729915052652359,
-0.081... |
a1c4caca-dd73-40e7-a6c1-ae51d2e6a321 | :::tip
You can't decompress ClickHouse database files with external utilities like
lz4
. Instead, use the special
clickhouse-compressor
utility.
:::
Compression is supported for the following table engines:
MergeTree
family. Supports column compression codecs and selecting the default compression method by
c... | {"source_file": "table.md"} | [
-0.0297867339104414,
0.001681094174273312,
-0.07124830037355423,
-0.004598549567162991,
0.03727873042225838,
-0.05713754892349243,
-0.06572665274143219,
-0.0062104021199047565,
-0.06380581855773926,
0.01921882852911949,
0.01862870715558529,
-0.00930141843855381,
0.0029527097940444946,
-0.0... |
3df27982-b0ef-4e91-b0f9-53c28870e8cd | DEFLATE_QPL-compressed data can only be transferred between ClickHouse nodes compiled with SSE 4.2 enabled.
Specialized Codecs {#specialized-codecs}
These codecs are designed to make compression more effective by exploiting specific features of the data. Some of these codecs do not compress data themselves, they ... | {"source_file": "table.md"} | [
-0.11833864450454712,
-0.001996249658986926,
-0.0439663864672184,
-0.0252996813505888,
-0.06212005019187927,
-0.03697708249092102,
-0.011526004411280155,
0.04923641309142113,
-0.005309771280735731,
-0.0035090213641524315,
0.018193647265434265,
0.014328692108392715,
-0.042883846908807755,
-... |
09f69331-1c8b-48f6-a85d-cb6e6a3f832b | FPC {#fpc}
FPC(level, float_size)
- Repeatedly predicts the next floating point value in the sequence using the better of two predictors, then XORs the actual with the predicted value, and leading-zero compresses the result. Similar to Gorilla, this is efficient when storing a series of floating point values that ch... | {"source_file": "table.md"} | [
-0.01475876197218895,
0.025354798883199692,
-0.08738679438829422,
0.06377078592777252,
0.016313469037413597,
-0.09521441161632538,
-0.0807252898812294,
0.022393599152565002,
0.02035205066204071,
0.009041931480169296,
-0.019655095413327217,
-0.015603099018335342,
-0.08038848638534546,
0.011... |
b41d8d27-2ecc-4d27-bf3d-657dfff6224a | :::note
Most engines including the "*MergeTree" family create index files on disk without applying codecs. This means plaintext will appear on disk if an encrypted column is indexed.
:::
:::note
If you perform a SELECT query mentioning a specific value in an encrypted column (such as in its WHERE clause), the value m... | {"source_file": "table.md"} | [
-0.041144710034132004,
0.018014969304203987,
-0.07466107606887817,
0.028124868869781494,
0.009572131559252739,
-0.07767113298177719,
0.029218444600701332,
0.011336691677570343,
0.029061954468488693,
0.09484757483005524,
0.07103033363819122,
-0.026950130239129066,
0.0710441991686821,
-0.044... |
60681d73-122e-425d-a093-eefba209a4cc | :::note
This statement is supported for the
Atomic
and
Replicated
database engines,
which are the default database engines for ClickHouse and ClickHouse Cloud respectively.
:::
Ordinarily, if you need to delete some data from a table,
you can create a new table and fill it with a
SELECT
statement that does no... | {"source_file": "table.md"} | [
-0.023772437125444412,
-0.053376197814941406,
0.052476752549409866,
0.0344260148704052,
-0.09154204279184341,
0.0023920699022710323,
0.035367462784051895,
-0.05821089446544647,
0.004233409650623798,
0.11059848964214325,
0.05958272144198418,
0.04642544314265251,
0.09223032742738724,
-0.1023... |
b3d4a143-3281-4043-9e7c-9806576c3143 | You can add a comment to the table when creating it.
Syntax
sql
CREATE TABLE db.table_name
(
name1 type1, name2 type2, ...
)
ENGINE = engine
COMMENT 'Comment'
Example
Query:
sql
CREATE TABLE t1 (x String) ENGINE = Memory COMMENT 'The temporary table';
SELECT name, comment FROM system.tables WHERE name = '... | {"source_file": "table.md"} | [
0.008066674694418907,
-0.07656770199537277,
-0.0804404765367508,
0.11495450884103775,
-0.0634300634264946,
-0.03632556274533272,
0.06379283964633942,
0.00827023945748806,
-0.05139772966504097,
0.02404758520424366,
0.04208381101489067,
-0.05397285148501396,
0.09941652417182922,
-0.008581493... |
711e3018-45c3-4875-badb-4d4b49ddedf0 | description: 'Documentation for Dictionary'
sidebar_label: 'DICTIONARY'
sidebar_position: 38
slug: /sql-reference/statements/create/dictionary
title: 'CREATE DICTIONARY'
doc_type: 'reference'
Creates a new
dictionary
with given
structure
,
source
,
layout
and
lifetime
.
Syntax {#syntax}
sql
CREATE [OR RE... | {"source_file": "dictionary.md"} | [
-0.004427952691912651,
-0.005005029961466789,
-0.07762733101844788,
0.04902404919266701,
-0.05578070133924484,
-0.01120967511087656,
0.03483959287405014,
0.01413073018193245,
-0.08447781205177307,
0.01014167070388794,
0.07149441540241241,
-0.03680317476391792,
0.1460280865430832,
-0.041895... |
fbc839f4-d5b9-4867-9dd7-14ca2ed27519 | Create a dictionary from a table in a remote ClickHouse service {#create-a-dictionary-from-a-table-in-a-remote-clickhouse-service}
Input table (in the remote ClickHouse service)
source_table
:
text
┌─id─┬─value──┐
│ 1 │ First │
│ 2 │ Second │
└────┴────────┘
Creating the dictionary:
sql
CREATE DICTIONARY id... | {"source_file": "dictionary.md"} | [
0.021319622173905373,
-0.04707934334874153,
-0.1515442579984665,
-0.0005266311345621943,
-0.04738462343811989,
-0.06881009042263031,
0.04052939638495445,
-0.0337802916765213,
-0.04701676964759827,
0.05931546911597252,
0.04519730433821678,
-0.022898906841874123,
0.08505783975124359,
-0.0498... |
1fb2ca8c-0e10-4f74-8196-5a6aa203e4ff | description: 'Documentation for CREATE NAMED COLLECTION'
sidebar_label: 'NAMED COLLECTION'
slug: /sql-reference/statements/create/named-collection
title: 'CREATE NAMED COLLECTION'
doc_type: 'reference'
import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge';
CREATE NAMED COLLECTION
Creates a... | {"source_file": "named-collection.md"} | [
-0.036305297166109085,
-0.021322118118405342,
-0.057857491075992584,
0.06375658512115479,
-0.06840959936380386,
0.004707366693764925,
0.02604687213897705,
-0.05379166826605797,
0.03331947699189186,
0.06324958056211472,
0.051500823348760605,
-0.06591358780860901,
0.10054301470518112,
-0.060... |
55d49dbd-f150-46d8-b5d6-496c99d6d3ef | description: 'Documentation for CREATE Queries'
sidebar_label: 'CREATE'
sidebar_position: 34
slug: /sql-reference/statements/create/
title: 'CREATE Queries'
doc_type: 'reference'
CREATE Queries
CREATE queries create (for example) new
databases
,
tables
and
views
. | {"source_file": "index.md"} | [
-0.008502923883497715,
-0.0424555167555809,
-0.07719875872135162,
0.08701630681753159,
-0.09642838686704636,
0.00494189839810133,
0.05096187815070152,
0.053707223385572433,
-0.023415936157107353,
0.03670715168118477,
0.0037561035715043545,
-0.015208618715405464,
0.09316179901361465,
-0.047... |
54fadbc9-1663-4c28-9b71-4ae0e34a571c | description: 'Documentation for Settings Profile'
sidebar_label: 'SETTINGS PROFILE'
sidebar_position: 43
slug: /sql-reference/statements/create/settings-profile
title: 'CREATE SETTINGS PROFILE'
doc_type: 'reference'
Creates
settings profiles
that can be assigned to a user or a role.
Syntax:
sql
CREATE SETTING... | {"source_file": "settings-profile.md"} | [
0.018710022792220116,
-0.026725174859166145,
-0.06962009519338608,
0.10281243175268173,
-0.09279485791921616,
0.05795132741332054,
0.06779354810714722,
0.08406226336956024,
-0.1469312459230423,
-0.037398889660835266,
0.0040701450780034065,
-0.05463476479053497,
0.13771682977676392,
-0.0171... |
981f4109-80cf-4958-ac38-66f9b4c4e2dc | description: 'Documentation for User'
sidebar_label: 'USER'
sidebar_position: 39
slug: /sql-reference/statements/create/user
title: 'CREATE USER'
doc_type: 'reference'
Creates
user accounts
.
Syntax:
sql
CREATE USER [IF NOT EXISTS | OR REPLACE] name1 [, name2 [,...]] [ON CLUSTER cluster_name]
[NOT IDENTIFI... | {"source_file": "user.md"} | [
0.057844843715429306,
-0.020564822480082512,
-0.1296044886112213,
0.020993785932660103,
-0.04434159770607948,
0.008557640947401524,
0.02589450031518936,
-0.015523414127528667,
-0.06134593114256859,
-0.008410955779254436,
0.04243491217494011,
-0.07723214477300644,
0.09514506906270981,
-0.02... |
aa8d4c39-ea4c-4a4b-9e1a-8b0b84362cc9 | :::note
In ClickHouse Cloud, by default, passwords must meet the following complexity requirements:
- Be at least 12 characters long
- Contain at least 1 numeric character
- Contain at least 1 uppercase character
- Contain at least 1 lowercase character
- Contain at least 1 special character
:::
Examples {#examples}
... | {"source_file": "user.md"} | [
-0.033627379685640335,
-0.08150333166122437,
-0.11687745153903961,
-0.05408424139022827,
-0.09129606187343597,
0.0038416797760874033,
0.11422356963157654,
-0.0498950369656086,
0.007766162510961294,
0.015341350808739662,
0.043485842645168304,
-0.00888095237314701,
0.11619308590888977,
-0.00... |
6511f043-3d77-47e6-812e-9992aceea486 | xml
<bcrypt_workfactor>12</bcrypt_workfactor>
The work factor must be between 4 and 31, with a default value of 12.
:::warning
For applications with high-frequency authentication,
consider alternative authentication methods due to
bcrypt's computational overhead at higher work factors.
:::
6.
6. Th... | {"source_file": "user.md"} | [
-0.017076872289180756,
-0.05881175398826599,
-0.1283082813024521,
-0.05237339809536934,
-0.11357667297124863,
0.0025274893268942833,
0.07723138481378555,
-0.03520434722304344,
-0.01713375188410282,
-0.054797615855932236,
-0.0297815203666687,
-0.06498484313488007,
0.09867352992296219,
-0.02... |
1e55b426-2cca-44cd-9b3f-6600a873a30a | CREATE USER mira@'127.0.0.1'
— Equivalent to the
HOST IP
syntax.
CREATE USER mira@'localhost'
— Equivalent to the
HOST LOCAL
syntax.
CREATE USER mira@'192.168.%.%'
— Equivalent to the
HOST LIKE
syntax.
:::tip
ClickHouse treats
user_name@'address'
as a username as a whole. Thus, technically you can cr... | {"source_file": "user.md"} | [
-0.038025882095098495,
-0.05649835988879204,
-0.025321844965219498,
-0.017802070826292038,
-0.08455583453178406,
-0.018720543012022972,
0.0690109059214592,
-0.021728897467255592,
-0.0041269417852163315,
-0.02211923524737358,
0.08855268359184265,
-0.03704036399722099,
0.06390822678804398,
0... |
4a064e45-3ff0-49e5-a5eb-e9de8d2c7648 | Create the user account
john
and make all his future roles default excepting
role1
and
role2
:
sql
CREATE USER john DEFAULT ROLE ALL EXCEPT role1, role2;
Create the user account
john
and allow him to grant his privileges to the user with
jack
account:
sql
CREATE USER john GRANTEES jack;
Use a query par... | {"source_file": "user.md"} | [
-0.0181864146143198,
-0.05038786306977272,
-0.03601302206516266,
-0.02876264601945877,
-0.2078673392534256,
0.022106042131781578,
0.07068408280611038,
0.029231004416942596,
-0.07828518003225327,
-0.02841968648135662,
-0.02086726948618889,
-0.04586397856473923,
0.09806343168020248,
0.058954... |
ddfca873-3002-4c30-b888-695c4e2d085a | description: 'Documentation for Row Policy'
sidebar_label: 'ROW POLICY'
sidebar_position: 41
slug: /sql-reference/statements/create/row-policy
title: 'CREATE ROW POLICY'
doc_type: 'reference'
Creates a
row policy
, i.e. a filter used to determine which rows a user can read from a table.
:::tip
Row policies make ... | {"source_file": "row-policy.md"} | [
-0.03506740927696228,
0.009752788580954075,
-0.0574980191886425,
0.03651697561144829,
0.01999448612332344,
0.029513293877243996,
0.10747943818569183,
-0.03813813626766205,
-0.0520583875477314,
0.061529140919446945,
0.05846719816327095,
-0.00514743197709322,
0.10081122070550919,
-0.03106880... |
9c8684ba-64bc-409e-b8e9-e3708f84b836 | A policy can be defined as restrictive as an alternative. Restrictive policies are combined using the boolean
AND
operator.
Here is the general formula:
text
row_is_visible = (one or more of the permissive policies' conditions are non-zero) AND
(all of the restrictive policies's conditions are no... | {"source_file": "row-policy.md"} | [
0.0053175403736531734,
-0.031189775094389915,
-0.054537758231163025,
-0.006409044377505779,
-0.014862088486552238,
0.0767161175608635,
0.08522553741931915,
-0.05345239117741585,
-0.0644766241312027,
0.05836787447333336,
0.015400328673422337,
-0.03511969745159149,
0.11401453614234924,
0.026... |
5a028fe9-cbfa-41fb-b596-b6b7cd5f54b2 | description: 'Documentation for Role'
sidebar_label: 'ROLE'
sidebar_position: 40
slug: /sql-reference/statements/create/role
title: 'CREATE ROLE'
doc_type: 'reference'
Creates new
roles
. Role is a set of
privileges
. A
user
assigned a role gets all the privileges of this role.
Syntax:
sql
CREATE ROLE [IF N... | {"source_file": "role.md"} | [
0.023291470482945442,
-0.03265994042158127,
-0.047449130564928055,
0.08117854595184326,
-0.08563563972711563,
0.03341853246092796,
0.09928413480520248,
0.03271956369280815,
-0.09231589734554291,
-0.033472124487161636,
0.007138030603528023,
-0.036302659660577774,
0.10624418407678604,
-0.004... |
10ebff74-792f-4b2c-8f9b-09e818698bf2 | description: 'Documentation for Quota'
sidebar_label: 'QUOTA'
sidebar_position: 42
slug: /sql-reference/statements/create/quota
title: 'CREATE QUOTA'
doc_type: 'reference'
Creates a
quota
that can be assigned to a user or a role.
Syntax:
sql
CREATE QUOTA [IF NOT EXISTS | OR REPLACE] name [ON CLUSTER cluster_n... | {"source_file": "quota.md"} | [
-0.002236379077658057,
0.015857119113206863,
-0.05616258829832077,
0.06977575272321701,
-0.07859410345554352,
0.018251756206154823,
0.06089222803711891,
0.02041724883019924,
-0.015417364425957203,
0.03874224051833153,
-0.027555666863918304,
-0.07213297486305237,
0.10696543753147125,
-0.027... |
eaee57db-94b9-4732-a684-537ecddb084b | description: 'Documentation for CREATE DATABASE'
sidebar_label: 'DATABASE'
sidebar_position: 35
slug: /sql-reference/statements/create/database
title: 'CREATE DATABASE'
doc_type: 'reference'
CREATE DATABASE
Creates a new database.
sql
CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine... | {"source_file": "database.md"} | [
-0.020442204549908638,
-0.13006645441055298,
-0.06794171780347824,
0.07623781263828278,
-0.04029698297381401,
-0.053189534693956375,
0.03154360130429268,
-0.02649707719683647,
-0.01002641674131155,
-0.022162847220897675,
0.04960920289158821,
-0.028420787304639816,
0.13102614879608154,
-0.0... |
b8b7a428-8445-4ce1-8c0c-d99bd083134c | description: 'Documentation for Geohash'
sidebar_label: 'Geohash'
slug: /sql-reference/functions/geo/geohash
title: 'Functions for Working with Geohash'
doc_type: 'reference'
Geohash {#geohash}
Geohash
is the geocode system, which subdivides Earth's surface into buckets of grid shape and encodes each cell into a... | {"source_file": "geohash.md"} | [
0.0712515190243721,
0.025682339444756508,
0.02151673287153244,
-0.0650639459490776,
-0.10085665434598923,
-0.042650558054447174,
0.04497925937175751,
0.02915131114423275,
-0.05617145076394081,
-0.0029181716963648796,
-0.006942553911358118,
-0.05154694616794586,
0.08833511173725128,
-0.0751... |
fcda0e71-14fc-4d99-bda6-c0b70055d5fd | Returned values
Array of precision-long strings of geohash-boxes covering provided area, you should not rely on order of items.
Array
(
String
).
[]
- Empty array if minimum latitude and longitude values aren't less than corresponding maximum values.
:::note
Function throws an exception if resulting arra... | {"source_file": "geohash.md"} | [
0.16611014306545258,
0.08347198367118835,
0.04830320551991463,
-0.03998153656721115,
-0.02825007401406765,
-0.023419000208377838,
0.03411509469151497,
-0.04131068289279938,
-0.016790149733424187,
0.014403347857296467,
-0.019627757370471954,
0.04497611150145531,
0.051814138889312744,
-0.059... |
7bdfe09e-07ee-45cf-86c5-877dd16eefa3 | description: 'Documentation for Svg'
sidebar_label: 'SVG'
slug: /sql-reference/functions/geo/svg
title: 'Functions for Generating SVG images from Geo data'
doc_type: 'reference'
Svg {#svg}
Returns a string of select SVG element tags from Geo data.
Syntax
sql
Svg(geometry,[style])
Aliases:
SVG
,
svg
Para... | {"source_file": "svg.md"} | [
0.033811576664447784,
0.028598152101039886,
-0.005923207383602858,
0.09664660692214966,
-0.013148505240678787,
-0.0925733745098114,
0.10930400341749191,
0.03759819269180298,
0.04368066042661667,
-0.05212533846497536,
-0.0384027436375618,
0.004291069228202105,
0.014426175504922867,
-0.07869... |
2f6e4511-69de-4e1f-b474-5acc3d4b11de | slug: /sql-reference/functions/geo/s2
sidebar_label: 'S2 Geometry'
title: 'Functions for Working with S2 Index'
description: 'Documentation for functions for working with S2 indexes'
doc_type: 'reference'
Functions for Working with S2 Index
S2Index {#s2index}
S2
is a geographical indexing system where all geog... | {"source_file": "s2.md"} | [
0.061076536774635315,
-0.030270304530858994,
-0.010580949485301971,
0.013137268833816051,
0.02486756630241871,
0.007808364927768707,
0.046768561005592346,
0.07587289810180664,
-0.004282431676983833,
-0.04604151099920273,
-0.025522945448756218,
0.0015949049266055226,
0.09146984666585922,
-0... |
3ac3a222-4316-4231-8949-0600846abcda | 1
— If the cells intersect.
UInt8
.
0
— If the cells don't intersect.
UInt8
.
Example
Query:
sql
SELECT s2CellsIntersect(9926595209846587392, 9926594385212866560) AS intersect;
Result:
text
┌─intersect─┐
│ 1 │
└───────────┘
s2CapContains {#s2capcontains}
Determines if a cap contains a S2 p... | {"source_file": "s2.md"} | [
0.06496681272983551,
-0.02449953928589821,
0.0027243990916758776,
0.014224902726709843,
0.07681257277727127,
-0.009996128268539906,
0.10718388855457306,
0.025735067203640938,
0.07752951979637146,
-0.00612025847658515,
0.031062770634889603,
-0.06883953511714935,
0.046206630766391754,
-0.007... |
786f178f-5b23-4011-a4c5-901a4e9f095a | Result:
text
┌─rectAdd───────────────────────────────────┐
│ (5179062030687166815,5177056748191934217) │
└───────────────────────────────────────────┘
s2RectContains {#s2rectcontains}
Determines if a given rectangle contains a S2 point. In the S2 system, a rectangle is represented by a type of S2Region called a
... | {"source_file": "s2.md"} | [
0.05019906908273697,
-0.030650652945041656,
0.012825826182961464,
-0.006430545821785927,
0.05163751170039177,
0.026767050847411156,
0.07823578268289566,
0.011989370919764042,
0.018186185508966446,
-0.07043491303920746,
0.006086278241127729,
-0.0548136942088604,
0.08755578845739365,
-0.0255... |
6deb242f-4403-4d59-97c3-bd6a0f4f1bba | Returned values
s2UnionRect2PointLow
— Low S2 cell id corresponding to the rectangle containing the intersection of the given rectangles.
UInt64
.
s2UnionRect2PointHi
— High S2 cell id corresponding to the rectangle containing the intersection of the given rectangles.
UInt64
.
Example
Query:
sql
SELEC... | {"source_file": "s2.md"} | [
0.03357095643877983,
0.023610373958945274,
-0.0033781896345317364,
-0.0050439974293112755,
-0.04123417288064957,
0.03871818631887436,
0.06550327688455582,
0.027175143361091614,
0.010568599216639996,
-0.08461132645606995,
0.037868253886699677,
-0.035303059965372086,
0.01345678512006998,
-0.... |
9a6821cb-9b6a-4229-a10f-f43d70f7cc51 | description: 'Documentation for Coordinates'
sidebar_label: 'Geographical Coordinates'
slug: /sql-reference/functions/geo/coordinates
title: 'Functions for Working with Geographical Coordinates'
doc_type: 'reference'
greatCircleDistance {#greatcircledistance}
Calculates the distance between two points on the Eart... | {"source_file": "coordinates.md"} | [
0.03669768571853638,
0.0030415141955018044,
-0.021943792700767517,
-0.023706281557679176,
0.0001632371568121016,
-0.054525312036275864,
0.022510536015033722,
0.1645592451095581,
-0.028953110799193382,
-0.08975014835596085,
0.07884590327739716,
-0.08789544552564621,
0.08256158232688904,
-0.... |
a1379394-766b-4342-8113-0cf7ecac8836 | Input parameters
lon1Deg
— Longitude of the first point in degrees.
lat1Deg
— Latitude of the first point in degrees.
lon2Deg
— Longitude of the second point in degrees.
lat2Deg
— Latitude of the second point in degrees.
Returned value
The central angle between two points in degrees.
Example
sql... | {"source_file": "coordinates.md"} | [
0.04060942679643631,
-0.06854255497455597,
-0.043103866279125214,
-0.032755061984062195,
-0.006227546837180853,
-0.03833572939038277,
0.07377222180366516,
0.05511755868792534,
0.023695938289165497,
-0.07543674111366272,
0.076481394469738,
-0.007581748068332672,
0.08393801003694534,
-0.0824... |
1ed055fb-0fc5-4b1b-9e3f-67c27935ae1c | description: 'Documentation for H3'
sidebar_label: 'H3 Indexes'
slug: /sql-reference/functions/geo/h3
title: 'Functions for Working with H3 Indexes'
doc_type: 'reference'
H3 Index {#h3-index}
H3
is a geographical indexing system where the Earth's surface is divided into a grid of even hexagonal cells. This syste... | {"source_file": "h3.md"} | [
0.021482175216078758,
0.017527027055621147,
-0.05650630220770836,
-0.055069781839847565,
-0.02317824587225914,
-0.07130812108516693,
-0.04226769506931305,
0.015083514153957367,
-0.001941363443620503,
-0.015475139953196049,
0.008553441613912582,
-0.032283395528793335,
0.034457944333553314,
... |
d630b5cc-0e84-4d61-aaee-0473dc53b915 | Syntax
sql
h3EdgeLengthKm(resolution)
Parameter
resolution
— Index resolution.
UInt8
. Range:
[0, 15]
.
Returned values
The average length of an
H3
hexagon edge in kilometers.
Float64
.
Example
Query:
sql
SELECT h3EdgeLengthKm(15) AS edgeLengthKm;
Result:
text
┌─edgeLengthKm─┐
│ 0.000... | {"source_file": "h3.md"} | [
0.04678582772612572,
0.04670008271932602,
-0.03885621950030327,
-0.009271640330553055,
-0.06347653269767761,
-0.080880306661129,
0.02429266832768917,
0.016712302342057228,
-0.06818915903568268,
-0.020322725176811218,
0.03919927775859833,
-0.050874244421720505,
0.0007349315565079451,
-0.081... |
ce9e5722-e019-4f0d-998e-efdde2508425 | Returned values
Array of pairs '(lat, lon)'.
Array
(
Float64
,
Float64
).
Example
Query:
sql
SELECT h3ToGeoBoundary(644325524701193974) AS coordinates;
Result:
text
┌─h3ToGeoBoundary(599686042433355775)────────────────────────────────────────────────────────────────────────────────────────────────────... | {"source_file": "h3.md"} | [
0.030207335948944092,
0.06977996975183487,
-0.12346743792295456,
-0.01215007808059454,
-0.018023112788796425,
-0.03676888719201088,
0.033843688666820526,
-0.006980817299336195,
-0.0337534137070179,
-0.02473538927733898,
0.020724941045045853,
-0.05915110185742378,
0.0008199750445783138,
-0.... |
1318e3fa-b28a-4158-bbd7-3326af7c2437 | h3HexAreaM2 {#h3hexaream2}
Returns average hexagon area in square meters at the given resolution.
Syntax
sql
h3HexAreaM2(resolution)
Parameter
resolution
— Index resolution. Range:
[0, 15]
.
UInt8
.
Returned value
Area in square meters.
Float64
.
Example
Query:
sql
SELECT h3HexAreaM2(13)... | {"source_file": "h3.md"} | [
0.11206308007240295,
0.03568558022379875,
-0.03916112706065178,
0.014041640795767307,
-0.02506008744239807,
-0.0463179275393486,
-0.037126414477825165,
-0.0023364019580185413,
-0.0793750137090683,
-0.016618233174085617,
0.03448550030589104,
-0.05920308455824852,
0.07349556684494019,
-0.076... |
d265d098-3005-4466-ad89-2e1ba3e3011f | Returned value
String representation of the H3 index.
String
.
Example
Query:
sql
SELECT h3ToString(617420388352917503) AS h3_string;
Result:
text
┌─h3_string───────┐
│ 89184926cdbffff │
└─────────────────┘
stringToH3 {#stringtoh3}
Converts the string representation to the
H3Index
(UInt64) repres... | {"source_file": "h3.md"} | [
0.05063030868768692,
0.047080110758543015,
-0.07851840555667877,
0.011116428300738335,
-0.050516802817583084,
0.006110884249210358,
0.020996257662773132,
0.00006140167533885688,
-0.00440224027261138,
-0.0472448505461216,
0.002398848067969084,
-0.061938460916280746,
0.017652297392487526,
-0... |
399db5fa-798c-4f86-a9bf-69c57ef77b1e | h3CellAreaRads2 {#h3cellarearads2}
Returns the exact area of a specific cell in square radians corresponding to the given input H3 index.
Syntax
sql
h3CellAreaRads2(index)
Parameter
index
— Hexagon index number.
UInt64
.
Returned value
Cell area in square radians.
Float64
.
Example
Query:
... | {"source_file": "h3.md"} | [
0.03889734297990799,
0.06948533654212952,
-0.04953967034816742,
0.021013423800468445,
-0.009204940870404243,
-0.006896561477333307,
0.011399323120713234,
0.028439665213227272,
0.007662912365049124,
-0.025008242577314377,
0.036204833537340164,
-0.08591575920581818,
-0.0054528843611478806,
-... |
833aede3-66da-4377-bd69-b19f7a87921d | Number of H3 indices.
Int64
.
Example
Query:
sql
SELECT h3NumHexagons(3) AS numHexagons;
Result:
text
┌─numHexagons─┐
│ 41162 │
└─────────────┘
h3PointDistM {#h3pointdistm}
Returns the "great circle" or "haversine" distance between pairs of GeoCoord points (latitude/longitude) pairs in meters.
... | {"source_file": "h3.md"} | [
0.062360603362321854,
0.012168006040155888,
-0.12127301841974258,
-0.011859249323606491,
-0.005888958927243948,
-0.018564525991678238,
0.04718610644340515,
0.06908504664897919,
0.02991405501961708,
-0.09973446279764175,
0.061135999858379364,
-0.07432980835437775,
0.06537459045648575,
-0.05... |
3e99d1c8-79c0-4caf-83b6-d146da282d64 | Returned value
Array of all pentagon H3 indexes.
Array
(
UInt64
).
Example
Query:
sql
SELECT h3GetPentagonIndexes(3) AS indexes;
Result:
text
┌─indexes────────────────────────────────────────────────────────┐
│ [590112357393367039,590464201114255359,590816044835143679,...] │
└──────────────────────────... | {"source_file": "h3.md"} | [
0.06735192239284515,
0.03309826925396919,
-0.05612862482666969,
0.026349639520049095,
-0.05853749439120293,
-0.02475195936858654,
0.030551301315426826,
-0.034882888197898865,
0.02642728015780449,
-0.03272959217429161,
0.014763523824512959,
0.015010172501206398,
0.011642936617136002,
-0.089... |
899af9e9-389d-4996-916d-8479815b023f | Returns a unidirectional edge H3 index based on the provided origin and destination and returns 0 on error.
Syntax
sql
h3GetUnidirectionalEdge(originIndex, destinationIndex)
Parameter
originIndex
— Origin Hexagon index number.
UInt64
.
destinationIndex
— Destination Hexagon index number.
UInt64
.
Re... | {"source_file": "h3.md"} | [
0.022443091496825218,
0.028658347204327583,
-0.0775158554315567,
0.03314456343650818,
-0.0013201514957472682,
-0.02777412347495556,
0.05667246878147125,
-0.05121370404958725,
-0.02341802604496479,
-0.03743304684758186,
0.06027897074818611,
-0.07409068197011948,
-0.013201075606048107,
-0.05... |
5df0e0c0-6be9-444d-8b3a-549e43de4b57 | origin
— Origin Hexagon index number.
UInt64
.
destination
— Destination Hexagon index number.
UInt64
.
Returns
(0,0)
if the provided input is not valid.
Example
Query:
sql
SELECT h3GetIndexesFromUnidirectionalEdge(1248204388774707199) AS indexes;
Result:
text
┌─indexes───────────────────────────... | {"source_file": "h3.md"} | [
0.046541620045900345,
0.03296720236539841,
-0.0878015011548996,
0.019977714866399765,
-0.01490720920264721,
-0.015806784853339195,
0.02976056933403015,
-0.0544186495244503,
-0.023999618366360664,
-0.04578995332121849,
0.020501727238297462,
-0.05691523104906082,
-0.020826289430260658,
-0.08... |
ef28380c-f0df-43eb-99d3-5850090ecfcf | description: 'Documentation for Index'
sidebar_label: 'Geo'
slug: /sql-reference/functions/geo/
title: 'Geo Functions'
doc_type: 'reference'
Functions for working with geometric objects, for example
to calculate distances between points on a sphere
,
compute geohashes
, and work with
h3 indexes
. | {"source_file": "index.md"} | [
0.01823163777589798,
0.017408376559615135,
-0.039708126336336136,
-0.0008554983069188893,
-0.05490031838417053,
-0.014224008657038212,
0.028842207044363022,
0.021714631468057632,
-0.04752079397439957,
-0.04365041106939316,
0.0037710510659962893,
0.0031376893166452646,
0.03850427269935608,
... |
be870eac-d092-4b2a-acc4-587a48548ecf | description: 'Documentation for Polygon'
sidebar_label: 'Polygons'
slug: /sql-reference/functions/geo/polygons
title: 'Functions for Working with Polygons'
doc_type: 'reference'
WKT {#wkt}
Returns a WKT (Well Known Text) geometric object from various
Geo Data Types
. Supported WKT objects are:
POINT
POLYGO... | {"source_file": "polygon.md"} | [
-0.09099327772855759,
0.025062311440706253,
-0.04535079747438431,
0.022887304425239563,
-0.0936400517821312,
-0.07719824463129044,
0.08735360950231552,
0.06592366099357605,
-0.01498428825289011,
-0.0268564336001873,
-0.06232553347945213,
-0.0759805366396904,
0.028482399880886078,
-0.059080... |
26f60f62-f3b9-4c6d-8289-96ba8b05d7d8 | Syntax {#syntax}
sql
readWKTPoint(wkt_string)
Arguments {#arguments}
wkt_string
: The input WKT string representing a Point geometry.
Returned value {#returned-value-2}
The function returns a ClickHouse internal representation of the Point geometry.
Example {#example-2}
sql
SELECT readWKTPoint('POINT ... | {"source_file": "polygon.md"} | [
-0.06280636787414551,
0.0129051823168993,
-0.08181723207235336,
0.03239592909812927,
-0.1208118125796318,
-0.06828015297651291,
0.1018475666642189,
0.06706584244966507,
0.007918194867670536,
-0.01458583865314722,
-0.04506431519985199,
-0.05461294949054718,
0.04745115339756012,
-0.065233759... |
c8e7f273-b2a8-4771-9b27-3e417187268d | response
0
readWKBMultiPolygon {#readwkbmultipolygon}
Converts a WKB (Well Known Binary) MultiPolygon into a MultiPolygon type.
Example {#example-7}
```sql
SELECT
toTypeName(readWKBMultiPolygon(unhex('01060000000200000001030000000200000005000000000000000000004000000000000000000000000000002440000000000000000... | {"source_file": "polygon.md"} | [
-0.026690151542425156,
0.05105305835604668,
-0.067717045545578,
0.021470630541443825,
-0.08678349107503891,
-0.028165824711322784,
0.07074631005525589,
0.008356086909770966,
-0.07480908185243607,
-0.03199264779686928,
-0.06604315340518951,
-0.09105981141328812,
0.07165856659412384,
-0.0676... |
3c55e751-399e-4823-9c02-18d137df6b44 | Returned value {#returned-value-8}
The function returns a ClickHouse internal representation of the Point geometry.
Example {#example-9}
sql
SELECT readWKBPoint(unhex('0101000000333333333333f33f3333333333330b40'));
response
(1.2,3.4)
readWKBLineString {#readwkblinestring}
Parses a Well-Known Binary (WKB) re... | {"source_file": "polygon.md"} | [
-0.03708576038479805,
0.012270375154912472,
-0.07486893981695175,
0.026548152789473534,
-0.10488545894622803,
-0.032720897346735,
0.06687162816524506,
0.05857153236865997,
0.006347296293824911,
-0.03656868264079094,
-0.04925253987312317,
-0.07385211437940598,
0.06278245896100998,
-0.093571... |
7602e6be-5411-4d7f-8ba0-95095227cdb6 | response
14.000714267493642
Input parameters {#input-parameters-6}
Two polygons
Returned value {#returned-value-13}
Float64
polygonsEqualsCartesian {#polygonsequalscartesian}
Returns true if two polygons are equal
Example {#example-14}
sql
SELECT polygonsEqualsCartesian([[[(1., 1.), (1., 4.), (4., 4.), ... | {"source_file": "polygon.md"} | [
0.022604189813137054,
0.023384997621178627,
0.02156873233616352,
0.0028268557507544756,
-0.11557555198669434,
-0.10678175836801529,
0.04895147681236267,
0.006590061821043491,
-0.04858379438519478,
-0.02141517773270607,
-0.06194630265235901,
-0.08973687887191772,
0.025603551417589188,
0.036... |
3f3260d8-10af-4798-b27e-5e37d0c86936 | Input parameters {#input-parameters-10}
Polygons
Returned value {#returned-value-17}
MultiPolygon
polygonsWithinCartesian {#polygonswithincartesian}
Returns true if the second polygon is within the first polygon.
Example {#example-18}
sql
SELECT polygonsWithinCartesian([[[(2., 2.), (2., 3.), (3., 3.), (3.... | {"source_file": "polygon.md"} | [
0.05792831629514694,
0.008211344480514526,
0.03433523699641228,
0.0012062379391863942,
0.004266562405973673,
-0.08489537984132767,
0.10464447736740112,
-0.04855755716562271,
-0.09555532038211823,
-0.047371987253427505,
-0.040814097970724106,
-0.0831824541091919,
0.027851026505231857,
0.007... |
da5c8538-3c66-403a-98bb-ea071cfff464 | Input parameters {#input-parameters-13}
Polygon
Returned value {#returned-value-20}
Float
polygonsUnionSpherical {#polygonsunionspherical}
Calculates a union (OR).
Example {#example-21}
sql
SELECT wkt(polygonsUnionSpherical([[[(4.3613577, 50.8651821), (4.349556, 50.8535879), (4.3602419, 50.8435626), (4.38... | {"source_file": "polygon.md"} | [
0.01979473978281021,
0.10622718185186386,
0.013821002095937729,
0.019188834354281425,
-0.06402807682752609,
-0.07605937868356705,
0.04179687425494194,
-0.0105785196647048,
-0.009220585227012634,
-0.008070171810686588,
-0.10805284231901169,
-0.11408564448356628,
-0.0031363442540168762,
-0.0... |
f4ba7575-1395-4c2e-bf89-006c86cb9e6f | text | {"source_file": "polygon.md"} | [
0.014475799165666103,
0.07228008657693863,
-0.021847393363714218,
0.027838286012411118,
-0.03255626931786537,
0.03891466185450554,
0.13196884095668793,
0.04014258459210396,
0.1118897944688797,
-0.04175683110952377,
0.040231991559267044,
0.0572623685002327,
0.014718570746481419,
-0.00237390... |
b3a43484-5093-4d40-8e32-6c17275169fa | POLYGON((30.0107 -15.6462,30.0502 -15.6401,30.09 -15.6294,30.1301 -15.6237,30.1699 -15.6322,30.1956 -15.6491,30.2072 -15.6532,30.2231 -15.6497,30.231 -15.6447,30.2461 -15.6321,30.2549 -15.6289,30.2801 -15.6323,30.2962 -15.639,30.3281 -15.6524,30.3567 -15.6515,30.3963 -15.636,30.3977 -15.7168,30.3993 -15.812,30.4013 -15... | {"source_file": "polygon.md"} | [
0.043543700128793716,
0.03943037986755371,
-0.04493918642401695,
-0.020002301782369614,
-0.07131647318601608,
-0.06915213167667389,
-0.03404568135738373,
0.04666741192340851,
-0.005156798753887415,
0.04048917070031166,
-0.026936467736959457,
-0.055087387561798096,
0.001702224020846188,
0.0... |
b045a30b-48ce-4d18-a87d-0be9270f94e3 | -18.4125,32.9868 -18.4223,32.9995 -18.4367,33.003 -18.4469,32.9964 -18.4671,32.9786 -18.4801,32.9566 -18.4899,32.9371 -18.501,32.9193 -18.51,32.9003 -18.5153,32.8831 -18.5221,32.8707 -18.5358,32.8683 -18.5526,32.8717 -18.5732,32.8845 -18.609,32.9146 -18.6659,32.9223 -18.6932,32.9202 -18.7262,32.9133 -18.753,32.9025 -18... | {"source_file": "polygon.md"} | [
0.04027903825044632,
-0.01428050547838211,
-0.00165465846657753,
-0.025072365999221802,
-0.10768580436706543,
-0.05703480541706085,
-0.04413134604692459,
-0.008151239715516567,
-0.0015711867017671466,
0.022787917405366898,
0.0014446991262957454,
-0.022505346685647964,
0.033953387290239334,
... |
7eff3435-5714-4ea5-b704-c914625cb434 | -22.364,31.2215 -22.3649,31.2135 -22.3619,31.1979 -22.3526,31.1907 -22.3506,31.1837 -22.3456,31.1633 -22.3226,31.1526 -22.3164,31.1377 -22.3185,31.1045 -22.3334,31.097 -22.3349,31.0876 -22.3369,31.0703 -22.3337,31.0361 -22.3196,30.9272 -22.2957,30.8671 -22.2896,30.8379 -22.2823,30.8053 -22.2945,30.6939 -22.3028,30.6743... | {"source_file": "polygon.md"} | [
0.04274081438779831,
-0.004556444473564625,
-0.028487976640462875,
0.03128381073474884,
-0.05189364030957222,
0.00944193359464407,
-0.04540500044822693,
-0.003535544266924262,
-0.05922453850507736,
0.0438263863325119,
0.0596550814807415,
-0.02652476727962494,
0.05064602941274643,
-0.028710... |
a4c3b46d-a7f5-4fab-8abd-7ec9dd0d07f0 | -20.4961,27.666 -20.4891,27.6258 -20.4886,27.5909 -20.4733,27.5341 -20.483,27.4539 -20.4733,27.3407 -20.473,27.306 -20.4774,27.2684 -20.4958,27.284 -20.3515,27.266 -20.2342,27.2149 -20.1105,27.2018 -20.093,27.1837 -20.0823,27.1629 -20.0766,27.1419 -20.0733,27.1297 -20.0729,27.1198 -20.0739,27.1096 -20.0732,27.0973 -20.... | {"source_file": "polygon.md"} | [
0.028348395600914955,
0.0019794697873294353,
0.030432650819420815,
0.015862124040722847,
-0.08529312163591385,
-0.03534896671772003,
-0.12779338657855988,
-0.01922130025923252,
-0.06796818971633911,
0.05311811342835426,
0.028741605579853058,
-0.02908089943230152,
0.004388401750475168,
-0.0... |
dc8044f9-a694-42b4-9adc-e831a14bbf2d | -17.9965,26.5702 -18.0029,26.5834 -18.0132,26.5989 -18.03,26.6127 -18.0412,26.6288 -18.0492,26.6857 -18.0668,26.7 -18.0692,26.7119 -18.0658,26.7406 -18.0405,26.7536 -18.033,26.7697 -18.029,26.794 -18.0262,26.8883 -17.9846,26.912 -17.992,26.9487 -17.9689,26.9592 -17.9647,27.0063 -17.9627,27.0213 -17.9585,27.0485 -17.944... | {"source_file": "polygon.md"} | [
0.0795801430940628,
-0.028996163979172707,
0.002814918290823698,
0.004079850390553474,
-0.04849027097225189,
-0.06286191940307617,
-0.03388640284538269,
-0.052454058080911636,
-0.04378121346235275,
0.04566550999879837,
0.03644726425409317,
-0.044695109128952026,
0.031042706221342087,
-0.03... |
9b7ffc87-f9be-4f29-876e-8c0c683a179a | Usage of polygonPerimeterSpherical function {#usage-of-polygon-perimeter-spherical} | {"source_file": "polygon.md"} | [
0.048622481524944305,
0.06593014299869537,
0.03893331065773964,
-0.01880887895822525,
0.009471931494772434,
-0.03489074483513832,
0.05696757137775421,
0.07028453052043915,
0.06075878068804741,
0.04837346449494362,
0.028776157647371292,
-0.046924371272325516,
-0.019257647916674614,
0.035454... |
e3c95675-f6d7-4f46-a05c-2e24d4a4982a | sql | {"source_file": "polygon.md"} | [
0.07582295686006546,
0.0011653322726488113,
-0.03202968090772629,
0.07204441726207733,
-0.10746068507432938,
0.006198782008141279,
0.1837887018918991,
0.028402604162693024,
-0.0444914735853672,
-0.0017817936604842544,
0.0661090537905693,
-0.0014285664074122906,
0.08542580902576447,
-0.0624... |
4b85e615-d24a-4c4d-8a13-6ce88fc35267 | SELECT round(polygonPerimeterSpherical([(30.010654, -15.646227), (30.050238, -15.640129), (30.090029, -15.629381), (30.130129, -15.623696), (30.16992, -15.632171), (30.195552, -15.649121), (30.207231, -15.653152), (30.223147, -15.649741), (30.231002, -15.644677), (30.246091, -15.632068), (30.254876, -15.628864), (30.28... | {"source_file": "polygon.md"} | [
0.03892688453197479,
0.04892747849225998,
0.021660393103957176,
-0.014320006594061852,
0.0064764986746013165,
-0.1059049591422081,
0.025093361735343933,
0.031369034200906754,
0.0062998561188578606,
0.007567460183054209,
-0.04303072765469551,
-0.09919038414955139,
-0.021841002628207207,
-0.... |
aba8d1be-f22f-4753-807b-bfb1e4c6c88a | (33.014656, -17.336667), (33.021633, -17.345555), (33.022459, -17.361471), (33.016258, -17.377181), (33.011651, -17.383991), (32.997448, -17.404983), (32.958174, -17.478467), (32.951663, -17.486218), (32.942981, -17.491593), (32.936573, -17.498311), (32.936676, -17.509369), (32.947218, -17.543166), (32.951663, -17.5514... | {"source_file": "polygon.md"} | [
0.04772958159446716,
-0.022699657827615738,
-0.01396819856017828,
-0.03392709419131279,
-0.02103043533861637,
-0.09710324555635452,
-0.014885281212627888,
-0.07105153053998947,
-0.054762184619903564,
-0.010779784061014652,
0.04656193032860756,
-0.013545367866754532,
0.010574140585958958,
-... |
2aed5917-0781-4bd6-b410-0f1633b883ba | (32.768521, -19.402794), (32.762217, -19.443412), (32.763354, -19.463979), (32.773947, -19.475864), (32.793119, -19.476691), (32.811309, -19.474521), (32.825365, -19.479172), (32.832187, -19.500876), (32.832497000000004, -19.519273), (32.825365, -19.59162), (32.825675, -19.600818), (32.828156, -19.610636), (32.829603, ... | {"source_file": "polygon.md"} | [
0.03424994647502899,
-0.02205260470509529,
-0.021139588207006454,
-0.013053659349679947,
-0.04067692533135414,
-0.08129923790693283,
-0.009491752833127975,
-0.028923293575644493,
-0.03769414499402046,
-0.02366645634174347,
0.02599494345486164,
-0.025169817730784416,
0.021409671753644943,
-... |
98f81200-a792-4ce3-b2cd-64025b096bc8 | -22.36189), (31.197868, -22.352588), (31.190685, -22.350624), (31.183657, -22.34556), (31.163348, -22.322616), (31.152599, -22.316414), (31.137717, -22.318482), (31.10454, -22.333364), (31.097048, -22.334922), (31.087642, -22.336878), (31.07033, -22.333674), (31.036121, -22.319618), (30.927187, -22.295744), (30.867087,... | {"source_file": "polygon.md"} | [
0.016660869121551514,
-0.019624676555395126,
-0.005853724665939808,
0.02765490673482418,
-0.04825924336910248,
-0.049470219761133194,
-0.03830277919769287,
-0.036479849368333817,
-0.06733241677284241,
-0.025108134374022484,
0.0639539435505867,
-0.010495263151824474,
0.042398691177368164,
-... |
10913372-4915-4992-ba66-0defcfa0b6c6 | -21.581266), (28.032893, -21.577855), (28.016563, -21.572894), (28.002559, -21.564212), (27.990415, -21.551913), (27.984731, -21.542922), (27.975739, -21.522561), (27.970571, -21.514396), (27.963698, -21.510469), (27.958066, -21.511502), (27.953208, -21.510469), (27.949281, -21.500754), (27.954448, -21.487835), (27.950... | {"source_file": "polygon.md"} | [
0.030520278960466385,
-0.026089955121278763,
-0.017361924052238464,
-0.002468520076945424,
-0.04901422932744026,
-0.06768249720335007,
-0.001305827870965004,
-0.021635254845023155,
-0.04338207095861435,
-0.023778587579727173,
0.05654224753379822,
-0.02492043375968933,
0.023213140666484833,
... |
fb0a66a9-cbc1-4587-ad6c-0f5d3b5127d6 | (26.292638, -19.572499), (26.239101, -19.571466), (26.194452, -19.560200000000002), (26.155488, -19.537153), (26.13027, -19.501082), (26.034359, -19.243734), (26.011414, -19.199809), (25.981132, -19.161775), (25.956534, -19.122088), (25.948576, -19.103277), (25.944855, -19.079196), (25.948059, -19.058732), (25.964389, ... | {"source_file": "polygon.md"} | [
0.02165043354034424,
-0.029520677402615547,
-0.000901044812053442,
-0.002558141713961959,
-0.05579742044210434,
-0.06271135807037354,
-0.004638553597033024,
-0.029323846101760864,
-0.03557113930583,
-0.03070431388914585,
0.040516216307878494,
-0.018787318840622902,
0.026232684031128883,
-0... |
efff2b4d-f22a-4616-ab3e-ca0f69c518d2 | (26.685689, -18.066751), (26.700003, -18.069232), (26.71194, -18.065821), (26.740569, -18.0405), (26.753591, -18.032955), (26.769714, -18.029028), (26.794002, -18.026237), (26.88826, -17.984586), (26.912031, -17.992027), (26.94867, -17.968876), (26.95916, -17.964742), (27.006289, -17.962675), (27.021275, -17.958541), (... | {"source_file": "polygon.md"} | [
0.03598804399371147,
-0.018230551853775978,
-0.013466350734233856,
-0.00815508607774973,
-0.03622802346944809,
-0.06806095689535141,
-0.01235707476735115,
-0.053527284413576126,
-0.04206715524196625,
-0.01858857087790966,
0.04944879189133644,
-0.012877080589532852,
0.01754477433860302,
-0.... |
bb6fece6-0633-4f53-bce6-97d36e0ccb78 | response
0.45539
Input parameters {#input-parameters-15}
Returned value {#returned-value-22}
polygonsIntersectionCartesian {#polygonsintersectioncartesian}
Calculates the intersection of polygons.
Example {#example-23}
sql
SELECT wkt(polygonsIntersectionCartesian([[[(0., 0.), (0., 3.), (1., 2.9), (2., 2.6),... | {"source_file": "polygon.md"} | [
0.044928841292858124,
0.040320586413145065,
0.013348951004445553,
-0.015534206293523312,
-0.04382844269275665,
-0.07903055101633072,
0.08825507760047913,
0.021225910633802414,
-0.05782062187790871,
-0.03091439977288246,
-0.052728764712810516,
-0.12360049784183502,
0.003030979074537754,
-0.... |
17f57be2-4827-4265-831c-7d230e775da1 | title: 'Storage efficiency - Time-series'
sidebar_label: 'Storage efficiency'
description: 'Improving time-series storage efficiency'
slug: /use-cases/time-series/storage-efficiency
keywords: ['time-series', 'storage efficiency', 'compression', 'data retention', 'TTL', 'storage optimization', 'disk usage']
show_related... | {"source_file": "04_storage-efficiency.md"} | [
-0.028078895062208176,
0.031392209231853485,
-0.055102743208408356,
0.07521367818117142,
-0.03876855969429016,
-0.052100274711847305,
0.027969855815172195,
0.040397465229034424,
0.027307962998747826,
0.027550596743822098,
0.008536580950021744,
0.05137012526392937,
0.06370676308870316,
0.01... |
a512d874-0e01-4718-8380-4ccb39570ef6 | sql
CREATE TABLE wikistat
(
`time` DateTime,
`project` String,
`subproject` String,
`path` String,
`hits` UInt64
)
ENGINE = MergeTree
ORDER BY (time);
sql
CREATE TABLE optimized_wikistat
(
`time` DateTime CODEC(Delta(4), ZSTD(1)),
`project` LowCardinality(String),
`subproject` LowCardi... | {"source_file": "04_storage-efficiency.md"} | [
0.046419333666563034,
0.029359346255660057,
0.011576879769563675,
0.055768903344869614,
-0.019060716032981873,
-0.1172039806842804,
0.020294055342674255,
0.07292527705430984,
-0.0017734614666551352,
0.0843505933880806,
0.043376997113227844,
-0.01057207677513361,
0.04736284539103508,
-0.039... |
d000ac8a-2f8b-41cf-b7e1-293ab41437ea | title: 'Date and time data types - Time-series'
sidebar_label: 'Date and time data types'
description: 'Time-series data types in ClickHouse.'
slug: /use-cases/time-series/date-time-data-types
keywords: ['time-series', 'DateTime', 'DateTime64', 'Date', 'data types', 'temporal data', 'timestamp']
show_related_blogs: tru... | {"source_file": "01_date-time-data-types.md"} | [
-0.04978110268712044,
-0.026950722560286522,
-0.004081618972122669,
0.011406326666474342,
-0.01766934059560299,
0.0011539761908352375,
-0.024706190451979637,
0.03634028509259224,
0.003464290639385581,
-0.038430143147706985,
-0.01745099201798439,
0.01605413481593132,
-0.04161440581083298,
0... |
ffc69b56-d90e-46b0-a490-86396f31dfaf | Timezones {#time-series-timezones}
Many use cases require having timezones stored as well. We can set the timezone as the last argument to the
DateTime
or
DateTime64
types:
sql
CREATE TABLE dtz
(
`id` Int8,
`dt_1` DateTime('Europe/Berlin'),
`dt_2` DateTime,
`dt64_1` DateTime64(9, 'Europe/Berlin'... | {"source_file": "01_date-time-data-types.md"} | [
0.02686993218958378,
-0.06509380042552948,
0.0022881918121129274,
-0.009259947575628757,
-0.05269695445895195,
-0.04978668689727783,
-0.03839481249451637,
-0.009914146736264229,
-0.009956318885087967,
-0.021904634311795235,
-0.04760352522134781,
-0.049982067197561264,
-0.03941548243165016,
... |
69151c14-cf8e-425d-b84b-e223c21408e0 | text
Row 1:
──────
current_time: 2025-03-12 12:35:01
toTypeName(current_time): DateTime
date_only: 2025-03-12 12:35:01.000
toTypeName(date_only): DateTime64(3)
And we can use
toDateTime
to go from
Date
or
DateTime64
back to
DateTime
:
sql
SELECT
now64() AS current_time,
... | {"source_file": "01_date-time-data-types.md"} | [
0.006954452954232693,
0.012850632891058922,
0.005625366233289242,
0.04337872937321663,
-0.03641759231686592,
0.020917534828186035,
0.04647825285792351,
-0.01970580406486988,
-0.04880881682038307,
0.013971288688480854,
-0.010201890952885151,
-0.05814080312848091,
-0.036215439438819885,
-0.0... |
1d1595ea-b332-40f9-9858-be4eae8a4a12 | title: 'Query performance - Time-series'
sidebar_label: 'Query performance'
description: 'Improving time-series query performance'
slug: /use-cases/time-series/query-performance
keywords: ['time-series', 'query performance', 'optimization', 'indexing', 'partitioning', 'query tuning', 'performance']
show_related_blogs: ... | {"source_file": "05_query-performance.md"} | [
-0.04914078488945961,
0.010376201011240482,
-0.025199607014656067,
0.04527432844042778,
-0.04713025689125061,
-0.02048635296523571,
0.0022325371392071247,
0.0007252118084579706,
0.03546999394893646,
0.01239524595439434,
-0.03544650971889496,
0.05580984801054001,
0.027086492627859116,
-0.00... |
0609b69a-6839-468f-baf2-c3bb48ed3e72 | sql
SELECT path, SUM(hits) AS v
FROM wikistat
WHERE toStartOfMonth(time) = '2015-05-01'
GROUP BY path
ORDER BY v DESC
LIMIT 10
```text
┌─path──────────────────┬────────v─┐
│ - │ 89650862 │
│ Angelsberg │ 19165753 │
│ Ana_Sayfa │ 6368793 │
│ Academy_Awards │ 4901276 ... | {"source_file": "05_query-performance.md"} | [
0.07343504577875137,
-0.0649825781583786,
-0.054802123457193375,
0.09011818468570709,
-0.014521492645144463,
-0.020313963294029236,
0.053153276443481445,
0.025068629533052444,
0.0114853885024786,
0.1373005360364914,
0.028264176100492477,
-0.04781914874911308,
0.048228971660137177,
-0.02734... |
bf3b17a1-7409-4732-8524-92ca40b36ae9 | sql
CREATE MATERIALIZED VIEW wikistat_backfill_top_mv
TO wikistat_top
AS
SELECT
path,
toStartOfMonth(time) AS month,
sum(hits) AS hits
FROM wikistat_backfill
GROUP BY path, month;
And then finally, we'll populate
wikistat_backfill
from the initial
wikistat
table:
sql
INSERT INTO wikistat_backfill
S... | {"source_file": "05_query-performance.md"} | [
-0.011607560329139233,
-0.08395034819841385,
-0.02868272364139557,
0.07230041921138763,
-0.047260284423828125,
0.008134874515235424,
-0.0018783671548590064,
-0.054562702775001526,
-0.006933207157999277,
0.09234485030174255,
0.040947724133729935,
-0.017290066927671432,
0.0526513047516346,
-... |
a801a71f-0156-48d1-97b3-32d463eaf057 | title: 'Analysis functions - Time-series'
sidebar_label: 'Analysis functions'
description: 'Functions for analyzing time-series data in ClickHouse.'
slug: /use-cases/time-series/analysis-functions
keywords: ['time-series', 'analysis functions', 'window functions', 'aggregation functions', 'moving averages', 'trend anal... | {"source_file": "03_analysis-functions.md"} | [
-0.053446169942617416,
-0.0752515122294426,
-0.07651251554489136,
0.00510648638010025,
-0.06221671402454376,
-0.03784199431538582,
0.0020801026839762926,
0.03127016872167587,
0.04032949358224869,
-0.0349949412047863,
-0.05400269478559494,
-0.02651100605726242,
-0.028868425637483597,
0.0467... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.