ClickHouse/docs/en/introduction/distinctive_features.md

65 lines
5.1 KiB
Markdown
Raw Normal View History

2020-03-20 10:10:48 +00:00
# Distinctive Features of ClickHouse {#distinctive-features-of-clickhouse}
2020-03-20 10:10:48 +00:00
## True Column-Oriented DBMS {#true-column-oriented-dbms}
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
In a true column-oriented DBMS, no extra data is stored with the values. Among other things, this means that constant-length values must be supported, to avoid storing their length “number” next to the values. As an example, a billion UInt8-type values should actually consume around 1 GB uncompressed, or this will strongly affect the CPU use. It is very important to store data compactly (without any “garbage”) even when uncompressed, since the speed of decompression (CPU usage) depends mainly on the volume of uncompressed data.
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
This is worth noting because there are systems that can store values of different columns separately, but that cant effectively process analytical queries due to their optimization for other scenarios. Examples are HBase, BigTable, Cassandra, and HyperTable. In these systems, you will get throughput around a hundred thousand rows per second, but not hundreds of millions of rows per second.
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
Its also worth noting that ClickHouse is a database management system, not a single database. ClickHouse allows creating tables and databases in runtime, loading data, and running queries without reconfiguring and restarting the server.
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
## Data Compression {#data-compression}
Some column-oriented DBMSs (InfiniDB CE and MonetDB) do not use data compression. However, data compression does play a key role in achieving excellent performance.
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
## Disk Storage of Data {#disk-storage-of-data}
2020-03-20 10:10:48 +00:00
Keeping data physically sorted by primary key makes it possible to extract data for its specific values or value ranges with low latency, less than few dozen milliseconds. Some column-oriented DBMSs (such as SAP HANA and Google PowerDrill) can only work in RAM. This approach encourages the allocation of a larger hardware budget than is actually necessary for real-time analysis. ClickHouse is designed to work on regular hard drives, which means the cost per GB of data storage is low, but SSD and additional RAM are also fully used if available.
2020-03-20 10:10:48 +00:00
## Parallel Processing on Multiple Cores {#parallel-processing-on-multiple-cores}
2017-04-03 19:49:50 +00:00
2018-09-06 17:40:13 +00:00
Large queries are parallelized in a natural way, taking all the necessary resources that available on the current server.
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
## Distributed Processing on Multiple Servers {#distributed-processing-on-multiple-servers}
2018-09-06 17:40:13 +00:00
Almost none of the columnar DBMSs mentioned above have support for distributed query processing.
2017-04-26 16:07:48 +00:00
In ClickHouse, data can reside on different shards. Each shard can be a group of replicas that are used for fault tolerance. The query is processed on all the shards in parallel. This is transparent for the user.
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
## SQL Support {#sql-support}
ClickHouse supports a declarative query language based on SQL that is identical to the SQL standard in many cases.
Supported queries include GROUP BY, ORDER BY, subqueries in FROM, IN, and JOIN clauses, and scalar subqueries.
Dependent subqueries and window functions are not supported.
2020-03-20 10:10:48 +00:00
## Vector Engine {#vector-engine}
2018-09-06 17:40:13 +00:00
Data is not only stored by columns, but is processed by vectors (parts of columns). This allows us to achieve high CPU efficiency.
2020-03-20 10:10:48 +00:00
## Real-time Data Updates {#real-time-data-updates}
2017-04-03 19:49:50 +00:00
2018-09-06 17:40:13 +00:00
ClickHouse supports tables with a primary key. In order to quickly perform queries on the range of the primary key, the data is sorted incrementally using the merge tree. Due to this, data can continually be added to the table. No locks are taken when new data is ingested.
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
## Index {#index}
2020-03-20 10:10:48 +00:00
Having a data physically sorted by primary key makes it possible to extract data for its specific values or value ranges with low latency, less than few dozen milliseconds.
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
## Suitable for Online Queries {#suitable-for-online-queries}
2018-09-06 17:40:13 +00:00
Low latency means that queries can be processed without delay and without trying to prepare answer in advance, right at the same moment while user interface page is loading. In other words, online.
2020-03-20 10:10:48 +00:00
## Support for Approximated Calculations {#support-for-approximated-calculations}
2018-09-06 17:40:13 +00:00
ClickHouse provides various ways to trade accuracy for performance:
2020-03-20 10:10:48 +00:00
1. Aggregate functions for approximated calculation of the number of distinct values, medians, and quantiles.
2. Running a query based on a part (sample) of data and getting an approximated result. In this case, proportionally less data is retrieved from the disk.
3. Running an aggregation for a limited number of random keys, instead of for all keys. Under certain conditions for key distribution in the data, this provides a reasonably accurate result while using fewer resources.
2017-04-03 19:49:50 +00:00
2020-03-20 10:10:48 +00:00
## Data replication and data integrity support {#data-replication-and-data-integrity-support}
2017-04-03 19:49:50 +00:00
Uses asynchronous multimaster replication. After being written to any available replica, data is distributed to all the remaining replicas in the background. The system maintains identical data on different replicas. Recovery after most failures is performed automatically, and in complex cases — semi-automatically.
2017-04-03 19:49:50 +00:00
WIP on docs (#3813) * CLICKHOUSE-4063: less manual html @ index.md * CLICKHOUSE-4063: recommend markdown="1" in README.md * CLICKHOUSE-4003: manually purge custom.css for now * CLICKHOUSE-4064: expand <details> before any print (including to pdf) * CLICKHOUSE-3927: rearrange interfaces/formats.md a bit * CLICKHOUSE-3306: add few http headers * Remove copy-paste introduced in #3392 * Hopefully better chinese fonts #3392 * get rid of tabs @ custom.css * Apply comments and patch from #3384 * Add jdbc.md to ToC and some translation, though it still looks badly incomplete * minor punctuation * Add some backlinks to official website from mirrors that just blindly take markdown sources * Do not make fonts extra light * find . -name '*.md' -type f | xargs -I{} perl -pi -e 's//g' {} * find . -name '*.md' -type f | xargs -I{} perl -pi -e 's/ sql/g' {} * Remove outdated stuff from roadmap.md * Not so light font on front page too * Refactor Chinese formats.md to match recent changes in other languages * Update some links on front page * Remove some outdated comment * Add twitter link to front page * More front page links tuning * Add Amsterdam meetup link * Smaller font to avoid second line * Add Amsterdam link to README.md * Proper docs nav translation * Back to 300 font-weight except Chinese * fix docs build * Update Amsterdam link * remove symlinks * more zh punctuation * apply lost comment by @zhang2014 * Apply comments by @zhang2014 from #3417 * Remove Beijing link * rm incorrect symlink * restore content of docs/zh/operations/table_engines/index.md * CLICKHOUSE-3751: stem terms while searching docs * CLICKHOUSE-3751: use English stemmer in non-English docs too * CLICKHOUSE-4135 fix * Remove past meetup link * Add blog link to top nav * Add ContentSquare article link * Add form link to front page + refactor some texts * couple markup fixes * minor * Introduce basic ODBC driver page in docs * More verbose 3rd party libs disclaimer * Put third-party stuff into a separate folder * Separate third-party stuff in ToC too * Update links * Move stuff that is not really (only) a client library into a separate page * Add clickhouse-hdfs-loader link * Some introduction for "interfaces" section * Rewrite tcp.md * http_interface.md -> http.md * fix link * Remove unconvenient error for now * try to guess anchor instead of failing * remove symlink * Remove outdated info from introduction * remove ru roadmap.md * replace ru roadmap.md with symlink * Update roadmap.md * lost file * Title case in toc_en.yml * Sync "Functions" ToC section with en * Remove reference to pretty old ClickHouse release from docs * couple lost symlinks in fa * Close quote in proper place * Rewrite en/getting_started/index.md * Sync en<>ru getting_started/index.md * minor changes * Some gui.md refactoring * Translate DataGrip section to ru * Translate DataGrip section to zh * Translate DataGrip section to fa * Translate DBeaver section to fa * Translate DBeaver section to zh * Split third-party GUI to open-source and commercial * Mention some RDBMS integrations + ad-hoc translation fixes * Add rel="external nofollow" to outgoing links from docs * Lost blank lines * Fix class name * More rel="external nofollow" * Apply suggestions by @sundy-li * Mobile version of front page improvements * test * test 2 * test 3 * Update LICENSE * minor docs fix * Highlight current article as suggested by @sundy-li * fix link destination * Introduce backup.md (only "en" for now) * Mention INSERT+SELECT in backup.md * Some improvements for replication.md * Add backup.md to toc * Mention clickhouse-backup tool * Mention LightHouse in third-party GUI list * Introduce interfaces/third-party/proxy.md * Add clickhouse-bulk to proxy.md * Major extension of integrations.md contents * fix link target * remove unneeded file * better toc item name * fix markdown * better ru punctuation * Add yet another possible backup approach * Simplify copying permalinks to headers * Support non-eng link anchors in docs + update some deps * Generate anchors for single-page mode automatically * Remove anchors to top of pages * Remove anchors that nobody links to * build fixes * fix few links * restore css * fix some links * restore gifs * fix lost words * more docs fixes * docs fixes * NULL anchor * update urllib3 dependency * more fixes
2018-12-12 17:28:00 +00:00
For more information, see the section [Data replication](../operations/table_engines/replication.md).
2020-01-30 10:34:55 +00:00
[Original article](https://clickhouse.tech/docs/en/introduction/distinctive_features/) <!--hide-->