Merge pull request #2714 from blinkov/CLICKHOUSE-2720

Refactoring that also fixes CLICKHOUSE-3858
This commit is contained in:
alexey-milovidov 2018-07-25 14:23:07 +03:00 committed by GitHub
commit 743f904a64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 55 deletions

View File

@ -78,9 +78,9 @@ See the difference? Read further to learn why this happens.
For example, the query "count the number of records for each advertising platform" requires reading one "advertising platform ID" column, which takes up 1 byte uncompressed. If most of the traffic was not from advertising platforms, you can expect at least 10-fold compression of this column. When using a quick compression algorithm, data decompression is possible at a speed of at least several gigabytes of uncompressed data per second. In other words, this query can be processed at a speed of approximately several billion rows per second on a single server. This speed is actually achieved in practice.
Example:
```bash
<details><summary>Example</summary>
<p>
<pre>
$ clickhouse-client
ClickHouse client version 0.0.52053.
Connecting to localhost:9000.
@ -122,7 +122,9 @@ LIMIT 20
20 rows in set. Elapsed: 0.153 sec. Processed 1.00 billion rows, 4.00 GB (6.53 billion rows/s., 26.10 GB/s.)
:)
```
</pre>
</p>
</details>
### CPU

View File

@ -78,9 +78,9 @@ ClickHouse - столбцовая система управления базам
Для примера, для запроса "посчитать количество записей для каждой рекламной системы", требуется прочитать один столбец "идентификатор рекламной системы", который занимает 1 байт в несжатом виде. Если большинство переходов было не с рекламных систем, то можно рассчитывать хотя бы на десятикратное сжатие этого столбца. При использовании быстрого алгоритма сжатия, возможно разжатие данных со скоростью более нескольких гигабайт несжатых данных в секунду. То есть, такой запрос может выполняться со скоростью около нескольких миллиардов строк в секунду на одном сервере. На практике, такая скорость действительно достигается.
Пример:
```bash
<details><summary>Пример</summary>
<p>
<pre>
$ clickhouse-client
ClickHouse client version 0.0.52053.
Connecting to localhost:9000.
@ -122,7 +122,9 @@ LIMIT 20
20 rows in set. Elapsed: 0.153 sec. Processed 1.00 billion rows, 4.00 GB (6.53 billion rows/s., 26.10 GB/s.)
:)
```
</pre>
</p>
</details>
### По вычислениям

View File

@ -60,6 +60,7 @@ def build_for_lang(lang, args):
'static_templates': ['404.html'],
'extra': {
'single_page': False,
'opposite_lang': 'en' if lang == 'ru' else 'ru',
'search': {
'language': 'en' if lang == 'en' else 'en, %s' % lang
}
@ -108,6 +109,7 @@ def build_single_page_version(lang, args, cfg):
'site_dir': temp,
'extra': {
'single_page': True,
'opposite_lang': 'en' if lang == 'ru' else 'ru',
'search': {
'language': 'en, ru'
}

View File

@ -224,34 +224,11 @@
}
});
}
function drawLanguageSwitch() {
var url, text, title;
if (window.location.pathname.indexOf('/ru/') >= 0) {
url = window.location.pathname.replace('/ru/', '/en/');
text = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"50\" height=\"30\" viewBox=\"0,0 25,15\" style=\"border:1px solid #eee;margin: .8rem 0 0 -1.25rem;\">\n" +
"<rect width=\"25\" height=\"15\" fill=\"#00247d\"></rect>\n" +
"<path d=\"M 0,0 L 25,15 M 25,0 L 0,15\" stroke=\"#fff\" stroke-width=\"3\"></path>\n" +
"<path d=\"M 12.5,0 V 15 M 0,7.5 H 25\" stroke=\"#fff\" stroke-width=\"5\"></path>\n" +
"<path d=\"M 12.5,0 V 15 M 0,7.5 H 25\" stroke=\"#cf142b\" stroke-width=\"3\"></path>\n" +
"</svg>";
title = "Switch to English"
} else {
url = window.location.pathname.replace('/en/', '/ru/');
text = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 10 6\" width=\"50\" height=\"30\" style=\"border: 1px solid #eee;margin: .8rem 0 0 -1.25rem\">\n" +
"<rect fill=\"#fff\" width=\"10\" height=\"3\"></rect>\n" +
"<rect fill=\"#d52b1e\" y=\"3\" width=\"10\" height=\"3\"></rect>\n" +
"<rect fill=\"#0039a6\" y=\"2\" width=\"10\" height=\"2\"></rect>\n" +
"</svg>";
title = "Переключить на русский язык"
}
document.getElementById("md-language-switch").innerHTML = '<a href="' + url + '" title="' + title + '" class="md-flex__ellipsis md-header-nav__title">' + text + '</a>';
}
ready(function () {
{% if config.extra.single_page and page.content %}
document.getElementById("content").innerHTML = {{ page.content|tojson|safe }};
document.getElementsByClassName('md-footer')[0].style.display = 'block';
{% endif %}
drawLanguageSwitch();
app.initialize({
version: "{{ mkdocs_version }}",
url: {

View File

@ -40,9 +40,27 @@
{% endif %}
{% endblock %}
</div>
{% if config.repo_url %}
{% if page %}
<div class="md-flex__cell md-flex__cell--shrink">
<div id="md-language-switch" class="md-header-nav__source">
{% if config.extra.lang == 'ru' %}
<a href="{{ base_url }}/../{{ config.theme.extra.opposite_lang }}{{ page.abs_url }}" title="Switch to English" class="md-flex__ellipsis md-header-nav__title">
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="30" viewBox="0,0 25,15" style="border:1px solid #eee;margin: .8rem 0 0 -1.25rem;">
<rect width="25" height="15" fill="#00247d"></rect>
<path d="M 0,0 L 25,15 M 25,0 L 0,15" stroke="#fff" stroke-width="3"></path>
<path d="M 12.5,0 V 15 M 0,7.5 H 25" stroke="#fff" stroke-width="5"></path>
<path d="M 12.5,0 V 15 M 0,7.5 H 25" stroke="#cf142b" stroke-width="3"></path>
</svg>
</a>
{% else %}
<a href="{{ base_url }}/../{{ config.theme.extra.opposite_lang }}{{ page.abs_url }}" title="Переключить на русский язык" class="md-flex__ellipsis md-header-nav__title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 6" width="50" height="30" style="border: 1px solid #eee;margin: .8rem 0 0 -1.25rem">
<rect fill="#fff" width="10" height="3"></rect>
<rect fill="#d52b1e" y="3" width="10" height="3"></rect>
<rect fill="#0039a6" y="2" width="10" height="2"></rect>
</svg>
</a>
{% endif %}
</div>
</div>
{% endif %}

View File

@ -1,9 +1,9 @@
<nav class="md-nav md-nav--primary" data-md-level="0">
{% if not config.extra.single_page %}
<label class="md-nav__title md-nav__title--site" for="drawer">
{{ config.site_name }}
</label>
{% if not config.extra.single_page %}
<ul class="md-nav__list" data-md-scrollfix>
{% for nav_item in nav %}
{% set path = "nav-" + loop.index | string %}
@ -15,32 +15,30 @@
<ul id="md-extra-nav" class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--active">
<script type="text/javascript">
if (window.location.pathname.indexOf('/ru/') >= 0) {
if (window.location.pathname.indexOf('/single/') >= 0) {
document.write("<a href=\"{{ base_url }}/../\" class=\"md-nav__link md-nav__link--active\">Многостраничная версия</a>")
} else {
document.write("<a href=\"{{ base_url }}/single/\" class=\"md-nav__link md-nav__link--active\">Одностраничная версия</a>")
}
} else {
if (window.location.pathname.indexOf('/single/') >= 0) {
document.write("<a href=\"{{ base_url }}/../\" class=\"md-nav__link md-nav__link--active\">Multi page version</a>")
}else{
document.write("<a href=\"{{ base_url }}/single/\" class=\"md-nav__link md-nav__link--active\">Single page version</a>")
}
}
</script>
{% if config.theme.language == 'ru' %}
{% if config.extra.single_page %}
<a href="{{ base_url }}" class="md-nav__link md-nav__link--active">Многостраничная версия</a>
{% else %}
<a href="{{ base_url }}/single/" class="md-nav__link md-nav__link--active">Одностраничная версия</a>
{% endif %}
{% else %}
{% if config.extra.single_page %}
<a href="{{ base_url }}" class="md-nav__link md-nav__link--active">Multi page version</a>
{% else %}
<a href="{{ base_url }}/single/" class="md-nav__link md-nav__link--active">Single page version</a>
{% endif %}
{% endif %}
</li>
{% if config.repo_url %}
<li class="md-nav__item md-nav__item--active">
<a href="{{ config.repo_url }}" rel="external nofollow" target="_blank" class="md-nav__link">
<script type="text/javascript">
if (window.location.pathname.indexOf('/ru/') >= 0) {
document.write('Исходники ClickHouse');
} else {
document.write('ClickHouse sources');
}
</script>
{% if config.theme.language == 'ru' %}
Исходники ClickHouse
{% else %}
ClickHouse sources
{% endif %}
</a>
</li>
{% endif %}
</ul>
</nav>