Skip to content

Commit 40ed2ff

Browse files
committed
Merge branch 'image_component' of https://github.com/ClickHouse/clickhouse-docs into image_component
2 parents 1bb1c40 + 4ca4ee7 commit 40ed2ff

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

docs/_snippets/_launch_sql_console.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import cloud_connect_to_sql_console from '@site/static/images/_snippets/cloud-connect-to-sql-console.png';
22
import createservice8 from '@site/static/images/_snippets/createservice8.png';
3+
import Image from '@theme/IdealImage';
4+
35

46
:::tip SQL console
57
If you need a SQL client connection, your ClickHouse Cloud service has an associated web based SQL console; expand **Connect to SQL console** below for details.
@@ -10,10 +12,10 @@ If you need a SQL client connection, your ClickHouse Cloud service has an associ
1012

1113
From your ClickHouse Cloud services list, click on a service.
1214

13-
<img src={cloud_connect_to_sql_console} class="image" alt="Connect to SQL Console" />
15+
<Image img={cloud_connect_to_sql_console} alt="Connect to SQL Console" size="lg" force/>
1416

1517
This will redirect you to the SQL console.
1618

17-
<img src={createservice8} class="image" alt="SQL Console" />
19+
<Image img={createservice8} alt="SQL Console" size="lg" force/>
1820

1921
</details>

docs/intro.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ description: 'ClickHouse® is a column-oriented SQL database management system (
55
title: 'What is ClickHouse?'
66
---
77

8-
import RowOrientedExample from '@site/static/images/column-oriented-example-query.png';
9-
import RowOriented from '@site/static/images/row-oriented.gif';
10-
import ColumnOriented from '@site/static/images/column-oriented.gif';
8+
import column_example from '@site/static/images/column-oriented-example-query.png';
9+
import row_orientated from '@site/static/images/row-oriented.gif';
10+
import column_orientated from '@site/static/images/column-oriented.gif';
11+
import Image from '@theme/IdealImage';
1112

1213
ClickHouse® is a high-performance, column-oriented SQL database management system (DBMS) for online analytical processing (OLAP). It is available as both an [open-source software](https://github.com/ClickHouse/ClickHouse) and a [cloud offering](https://clickhouse.com/cloud).
1314

@@ -47,22 +48,22 @@ LIMIT 8;
4748

4849
You can [run this query on the ClickHouse SQL Playground](https://sql.clickhouse.com?query=U0VMRUNUIE1vYmlsZVBob25lTW9kZWwsIENPVU5UKCkgQVMgYyAKRlJPTSBtZXRyaWNhLmhpdHMgCldIRVJFIAogICAgICBSZWdpb25JRCA9IDIyOSAKICBBTkQgRXZlbnREYXRlID49ICcyMDEzLTA3LTAxJyAKICBBTkQgRXZlbnREYXRlIDw9ICcyMDEzLTA3LTMxJyAKICBBTkQgTW9iaWxlUGhvbmUgIT0gMCAKICBBTkQgTW9iaWxlUGhvbmVNb2RlbCBub3QgaW4gWycnLCAnaVBhZCddIApHUk9VUCBCWSBNb2JpbGVQaG9uZU1vZGVsCk9SREVSIEJZIGMgREVTQyAKTElNSVQgODs&chart=eyJ0eXBlIjoicGllIiwiY29uZmlnIjp7InhheGlzIjoiTW9iaWxlUGhvbmVNb2RlbCIsInlheGlzIjoiYyJ9fQ&run_query=true) that selects and filters [just a few out of over 100](https://sql.clickhouse.com/?query=U0VMRUNUIG5hbWUKRlJPTSBzeXN0ZW0uY29sdW1ucwpXSEVSRSBkYXRhYmFzZSA9ICdtZXRyaWNhJyBBTkQgdGFibGUgPSAnaGl0cyc7&tab=results&run_query=true) existing columns, returning the result within milliseconds:
4950

50-
<img src={RowOrientedExample} alt="Example query in a column-oriented database" />
51+
<Image img={column_example} alt="Example query in a column-oriented database" size="lg"/>
5152

5253
As you can see in the stats section in the above diagram, the query processed 100 million rows in 92 milliseconds, a throughput of approximately 300 million rows or just under 7 GB per second.
5354

5455
**Row-oriented DBMS**
5556

5657
In a row-oriented database, even though the query above only processes a few out of the existing columns, the system still needs to load the data from other existing columns from disk to memory. The reason for that is that data is stored on disk in chunks called [blocks](https://en.wikipedia.org/wiki/Block_(data_storage)) (usually fixed sizes, e.g., 4 KB or 8 KB). Blocks are the smallest units of data read from disk to memory. When an application or database requests data, the operating system’s disk I/O subsystem reads the required blocks from the disk. Even if only part of a block is needed, the entire block is read into memory (this is due to disk and file system design):
5758

58-
<img src={RowOriented} alt="Row-oriented database structure" />
59+
<Image img={row_orientated} alt="Row-oriented database structure" size="lg"/>
5960

6061
**Column-oriented DBMS**
6162

6263
Because the values of each column are stored sequentially one after the other on disk, no unnecessary data is loaded when the query from above is run.
6364
Because the block-wise storage and transfer from disk to memory is aligned with the data access pattern of analytical queries, only the columns required for a query are read from disk, avoiding unnecessary I/O for unused data. This is [much faster](https://benchmark.clickhouse.com/) compared to row-based storage, where entire rows (including irrelevant columns) are read:
6465

65-
<img src={ColumnOriented} alt="Column-oriented database structure" />
66+
<Image img={column_orientated} alt="Column-oriented database structure" size="lg"/>
6667

6768
## Data Replication and Integrity {#data-replication-and-integrity}
6869

src/theme/IdealImage/index.tsx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ export default function IdealImage(
105105
alt: string;
106106
background?: "white" | "black";
107107
border?: boolean;
108+
force?: boolean;
108109
},
109110
): ReactNode {
110-
const { img, size, alt, background, border, ...propsRest } = props;
111+
const { img, size, alt, background, border, force, ...propsRest } = props;
111112

112113
// In dev env just use regular img with original file
113114
if (typeof img === "string" || "default" in img) {
@@ -176,6 +177,24 @@ export default function IdealImage(
176177
marginBottom: "16px",
177178
};
178179

180+
const img_component = force ? (
181+
<img width={currentImage.width ?? 100} alt={alt} src={currentImage.path} />
182+
) : (
183+
<ReactIdealImage
184+
{...propsRest}
185+
height={currentImage.height ?? 100}
186+
alt={alt}
187+
width={currentImage.width ?? 100}
188+
placeholder={{ lqip: img.preSrc }}
189+
src={currentImage.path}
190+
srcSet={filteredSet.map((image) => ({
191+
...image,
192+
src: image.path,
193+
}))}
194+
style={imageStyles}
195+
/>
196+
);
197+
179198
return (
180199
<div style={containerStyles}>
181200
{/* Zoomed Image */}
@@ -207,19 +226,7 @@ export default function IdealImage(
207226
visibility: isZoomed ? "hidden" : "visible",
208227
}}
209228
>
210-
<ReactIdealImage
211-
{...propsRest}
212-
height={currentImage.height ?? 100}
213-
alt={alt}
214-
width={currentImage.width ?? 100}
215-
placeholder={{ lqip: img.preSrc }}
216-
src={currentImage.path}
217-
srcSet={filteredSet.map((image) => ({
218-
...image,
219-
src: image.path,
220-
}))}
221-
style={imageStyles}
222-
/>
229+
{img_component}
223230
</div>
224231
</div>
225232
);

0 commit comments

Comments
 (0)