Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
505 changes: 11 additions & 494 deletions docs/cloud/features/03_sql_console_features/03_query-endpoints.md

Large diffs are not rendered by default.

645 changes: 645 additions & 0 deletions docs/cloud/guides/SQL_console/query-endpoints.md

Large diffs are not rendered by default.

30 changes: 23 additions & 7 deletions docs/getting-started/example-datasets/youtube-dislikes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ The steps below will easily work on a local install of ClickHouse too. The only

## Step-by-step instructions {#step-by-step-instructions}

1. Let's see what the data looks like. The `s3cluster` table function returns a table, so we can `DESCRIBE` the result:
<VerticalStepper headerLevel="h3">

### Data exploration {#data-exploration}

Let's see what the data looks like. The `s3cluster` table function returns a table, so we can `DESCRIBE` the result:

```sql
DESCRIBE s3(
Expand Down Expand Up @@ -59,7 +63,10 @@ ClickHouse infers the following schema from the JSON file:
└─────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
```

2. Based on the inferred schema, we cleaned up the data types and added a primary key. Define the following table:
### Create the table {#create-the-table}

Based on the inferred schema, we cleaned up the data types and added a primary key.
Define the following table:

```sql
CREATE TABLE youtube
Expand Down Expand Up @@ -90,7 +97,9 @@ ENGINE = MergeTree
ORDER BY (uploader, upload_date)
```

3. The following command streams the records from the S3 files into the `youtube` table.
### Insert data {#insert-data}

The following command streams the records from the S3 files into the `youtube` table.

:::important
This inserts a lot of data - 4.65 billion rows. If you do not want the entire dataset, simply add a `LIMIT` clause with the desired number of rows.
Expand Down Expand Up @@ -133,7 +142,10 @@ Some comments about our `INSERT` command:
- The `upload_date` column contains valid dates, but it also contains strings like "4 hours ago" - which is certainly not a valid date. We decided to store the original value in `upload_date_str` and attempt to parse it with `toDate(parseDateTimeBestEffortUSOrZero(upload_date::String))`. If the parsing fails we just get `0`
- We used `ifNull` to avoid getting `NULL` values in our table. If an incoming value is `NULL`, the `ifNull` function is setting the value to an empty string

4. Open a new tab in the SQL Console of ClickHouse Cloud (or a new `clickhouse-client` window) and watch the count increase. It will take a while to insert 4.56B rows, depending on your server resources. (Without any tweaking of settings, it takes about 4.5 hours.)
### Count the number of rows {#count-row-numbers}

Open a new tab in the SQL Console of ClickHouse Cloud (or a new `clickhouse-client` window) and watch the count increase.
It will take a while to insert 4.56B rows, depending on your server resources. (Without any tweaking of settings, it takes about 4.5 hours.)

```sql
SELECT formatReadableQuantity(count())
Expand All @@ -146,7 +158,9 @@ FROM youtube
└─────────────────────────────────┘
```

5. Once the data is inserted, go ahead and count the number of dislikes of your favorite videos or channels. Let's see how many videos were uploaded by ClickHouse:
### Explore the data {#explore-the-data}

Once the data is inserted, go ahead and count the number of dislikes of your favorite videos or channels. Let's see how many videos were uploaded by ClickHouse:

```sql
SELECT count()
Expand All @@ -166,7 +180,7 @@ WHERE uploader = 'ClickHouse';
The query above runs so quickly because we chose `uploader` as the first column of the primary key - so it only had to process 237k rows.
:::

6. Let's look and likes and dislikes of ClickHouse videos:
Let's look and likes and dislikes of ClickHouse videos:

```sql
SELECT
Expand All @@ -193,7 +207,7 @@ The response looks like:
84 rows in set. Elapsed: 0.013 sec. Processed 155.65 thousand rows, 16.94 MB (11.96 million rows/s., 1.30 GB/s.)
```

7. Here is a search for videos with **ClickHouse** in the `title` or `description` fields:
Here is a search for videos with **ClickHouse** in the `title` or `description` fields:

```sql
SELECT
Expand Down Expand Up @@ -224,6 +238,8 @@ The results look like:
│ 3534 │ 62 │ 1 │ https://youtu.be/8nWRhK9gw10 │ CLICKHOUSE - Arquitetura Modular │
```

</VerticalStepper>

## Questions {#questions}

### If someone disables comments does it lower the chance someone will actually click like or dislike? {#if-someone-disables-comments-does-it-lower-the-chance-someone-will-actually-click-like-or-dislike}
Expand Down
Binary file modified static/images/cloud/sqlconsole/endpoints-completed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/cloud/sqlconsole/endpoints-configure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/cloud/sqlconsole/endpoints-curltest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/cloud/sqlconsole/endpoints-monitoring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/cloud/sqlconsole/endpoints-savequery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/cloud/sqlconsole/endpoints-testquery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.