Merge branch 'master' of github.com:ClickHouse/ClickHouse

This commit is contained in:
BayoNet 2019-09-27 09:24:13 +03:00
commit ef9d80d996
6 changed files with 23 additions and 1 deletions

View File

@ -114,6 +114,7 @@
M(SelectedRanges, "Number of (non-adjacent) ranges in all data parts selected to read from a MergeTree table.") \ M(SelectedRanges, "Number of (non-adjacent) ranges in all data parts selected to read from a MergeTree table.") \
M(SelectedMarks, "Number of marks (index granules) selected to read from a MergeTree table.") \ M(SelectedMarks, "Number of marks (index granules) selected to read from a MergeTree table.") \
\ \
M(Merge, "Number of launched background merges.") \
M(MergedRows, "Rows read for background merges. This is the number of rows before merge.") \ M(MergedRows, "Rows read for background merges. This is the number of rows before merge.") \
M(MergedUncompressedBytes, "Uncompressed bytes (for columns as they stored in memory) that was read for background merges. This is the number before merge.") \ M(MergedUncompressedBytes, "Uncompressed bytes (for columns as they stored in memory) that was read for background merges. This is the number before merge.") \
M(MergesTimeMilliseconds, "Total time spent for background merges.")\ M(MergesTimeMilliseconds, "Total time spent for background merges.")\

View File

@ -39,6 +39,7 @@ namespace ProfileEvents
extern const Event MergedRows; extern const Event MergedRows;
extern const Event MergedUncompressedBytes; extern const Event MergedUncompressedBytes;
extern const Event MergesTimeMilliseconds; extern const Event MergesTimeMilliseconds;
extern const Event Merge;
} }
namespace CurrentMetrics namespace CurrentMetrics
@ -508,7 +509,10 @@ public:
{ {
ProfileEvents::increment(ProfileEvents::MergedUncompressedBytes, value.read_bytes); ProfileEvents::increment(ProfileEvents::MergedUncompressedBytes, value.read_bytes);
if (stage.is_first) if (stage.is_first)
{
ProfileEvents::increment(ProfileEvents::MergedRows, value.read_rows); ProfileEvents::increment(ProfileEvents::MergedRows, value.read_rows);
ProfileEvents::increment(ProfileEvents::Merge);
}
updateWatch(); updateWatch();
merge_entry->bytes_read_uncompressed += value.read_bytes; merge_entry->bytes_read_uncompressed += value.read_bytes;

View File

@ -0,0 +1,14 @@
DROP TABLE IF EXISTS new_table_test;
DROP TABLE IF EXISTS check_table_test;
CREATE TABLE new_table_test(name String) ENGINE = MergeTree ORDER BY name;
INSERT INTO new_table_test VALUES ('test');
CREATE TABLE check_table_test(value1 UInt64, value2 UInt64) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO check_table_test (value1) SELECT value FROM system.events WHERE event = 'Merge';
OPTIMIZE TABLE new_table_test FINAL;
INSERT INTO check_table_test (value2) SELECT value FROM system.events WHERE event = 'Merge';
SELECT count() FROM check_table_test WHERE value2 > value1;
DROP TABLE new_table_test;
DROP TABLE check_table_test;

View File

@ -251,6 +251,8 @@ Columns:
- `value` ([Int64](../data_types/int_uint.md)) — Metric value. - `value` ([Int64](../data_types/int_uint.md)) — Metric value.
- `description` ([String](../data_types/string.md)) — Metric description. - `description` ([String](../data_types/string.md)) — Metric description.
The list of supported metrics you can find in the [dbms/src/Common/CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/src/Common/CurrentMetrics.cpp) source file of ClickHouse.
**Example** **Example**
```sql ```sql

View File

@ -10,7 +10,7 @@ Clickhouse 中最强大的表引擎当属 `MergeTree` (合并树)引擎及
这让你可以创建一个用于快速检索数据的小稀疏索引。 这让你可以创建一个用于快速检索数据的小稀疏索引。
- 允许使用分区,如果指定了 [键](custom_partitioning_key.md) 的话。 - 允许使用分区,如果指定了 [分区键](custom_partitioning_key.md) 的话。
在相同数据集和相同结果集的情况下 ClickHouse 中某些带分区的操作会比普通操作更快。查询中指定了分区键时 ClickHouse 会自动截取分区数据。这也有效增加了查询性能。 在相同数据集和相同结果集的情况下 ClickHouse 中某些带分区的操作会比普通操作更快。查询中指定了分区键时 ClickHouse 会自动截取分区数据。这也有效增加了查询性能。