小编Ser*_*bin的帖子

在Javascript中循环执行时间

让我们考虑以下代码段作为示例:

var len = 1000000,
    testArr = []

    for (var i = 0; i < len; i++) {
        testArr.push(i+1)
    }

    function mprofile(name, subject, object) {
        var start = new Date().getTime(),
            result = subject(object),
            end = new Date().getTime() - start
        console.log(name)
        console.log('Result: ' + result)
        console.log(end)
    }

    var length = testArr.length,
        start = new Date().getTime(),
        cnt = 0

    for (i = 0; i < length; i++) {
        cnt += testArr[i]
    }

    console.log('Regular loop:')
    console.log('Result: ' + cnt)
    console.log(new Date().getTime() - start); …
Run Code Online (Sandbox Code Playgroud)

javascript performance

13
推荐指数
2
解决办法
1129
查看次数

Clickhouse 改变物化视图的选择

我有以下设置:

CREATE TABLE IF NOT EXISTS request_income_buffer (
    timestamp UInt64,
    timestamp_micro Float32,
    traceId Int64,
    host String,
    type String,
    service String,
    message String,
    caller String,
    context String
) ENGINE = Kafka('kafka:9092', 'request_income', 'group', 'JSONEachRow');

CREATE MATERIALIZED VIEW IF NOT EXISTS request_income
ENGINE = MergeTree(date, microtime, 8192) AS
    SELECT
        toDate(toDateTime(timestamp)) AS `date`,
        toDateTime(timestamp) as `date_time`,
        timestamp,
        timestamp_micro AS `microtime`,
        traceId,
        host,
        type,
        service,
        message,
        caller,
        context
    FROM
        request_income_buffer;
Run Code Online (Sandbox Code Playgroud)

我想添加新列,例如。ipmy request_income表。根据文档,为了做到这一点,我需要执行以下步骤:

  1. 分离视图以停止接收来自 Kafka 的消息。

    分离表请求收入;

  2. 由于 Kafka 引擎不支持ALTER …

clickhouse

4
推荐指数
1
解决办法
4520
查看次数

标签 统计

clickhouse ×1

javascript ×1

performance ×1