太平洋战争

最近逛书店,看到了《太平洋战争三部曲》,翻看了之后觉得很有兴趣继续读,就下载到kindle上继续阅读,断断续续的把三本快要看完了,中间又穿插着看了美剧《太平洋战争》,和书对照,里面有些互相引证的部分。美剧中的是以美军普通士兵的视角来看待太平...

February 29, 2024 · notsobad

Clickhouse Thinking

列存储 https://clickhouse.com/docs/knowledgebase/key-value ch的列存储,每一列是独立的文件存储,select * from test where k = 1 limit 10的查询,如果k是order by的列,那么查找会很快速的定位到文件,然后文件内查找定位到行,然后就得到所在文件的行数,之后再去找其他所有列对应的文件,然后读取对应行...

January 22, 2024 · notsobad

Clickhouse Projections

确认projection生效: https://clickhouse.com/docs/knowledgebase/projection_example ReadFromPreparedSource (for_column2) 可以看出是走了projection clickhouse-23.12 :) explain indexes = 1 SELECT count() from table1_projections where column2 > 999 and column1 > 1; ┌─explain─────────────────────────────────────┐ │ Expression ((Projection + Before ORDER BY)) │ │ Aggregating │ │ Filter │ │ ReadFromPreparedSource (for_column2) │ └─...

January 19, 2024 · notsobad

Baby Talk

小朋友快要3岁了,有时候会说一些很有意思的话,这里做一些记录。 我好烦 //闹钟响了 Baby: 什么声音? Mom: 闹钟的声音 Baby:快把闹钟关掉,我好烦 //妈妈去关闹钟 无中生有 去取快递时 Baby: 是不是我的消防车到了 之前并没有答应过他要买消防车 拆快递时...

January 18, 2024 · notsobad

Clickhouse Optimize

Query cache https://clickhouse.com/docs/en/operations/query-cache https://clickhouse.com/blog/introduction-to-the-clickhouse-query-cache-and-design v23.1 开始支持Query cache, 即可以缓存查询结果,可以选择针对会话启用。 设置项: query_cache_min_query_runs 查询运行过多少次才会启用缓存 query_cache_min_query_duration 查询运行时间超过多少才会缓存 query_cache_ttl cache 过期时间 query_cache_max_entries 往缓存表中存储的缓存结果条数 use_query_cache 此查询是否使用缓存 enable_reads_from_query_cache 此查询是否先从缓存中读 enable_writes_to_query_cache 此查询的结果...

January 16, 2024 · notsobad

Clickhouse Deduplication

Deduplication Strategies 笔记 去重操作,CH不是在插入阶段去重,而是插入后,速度会很快,影响: 任何时间,数据中可能会有重复数据 分区合并时,才会去重 查询语句需要适配重复数据 几种合并: ReplacingMergeTree: 相同排序键的会被合并 CollapsingMergeTree: 有一个字段标识取消,可...

January 8, 2024 · notsobad

Clickhouse MV

《Everything you should know about materialized views.》 阅读笔记 原理 materialized views(以下简称MV)在insert的时候触发,并不会读源表,往一个表insert后,MV会从insert的数据中进行创建。 因此,源表甚至可以是个NULL Engine,即实际不...

January 4, 2024 · notsobad

Hello 2024

Hello 2024, goodby 2023. In 2024, I wish I’ll write more blog posts, at least one pre week. Last year, I finally got a basement to do some woodworking, and recently I bought a some wood and a lot of woodworking tools, every weekend I will go there and do some woodworking, I only finished a horse bench, three shelfs, wish I will finish one or two tables in 2024.

January 2, 2024 · notsobad

Zsh eat my curl Output

I got a strange problem today, a URL is supposed to return something in it’s body, but when use curl to get that url, it outputs nothing. curl 'http://localhost:9527/static/a.js' At first, I think it might be server problems, but when using wireshark to see the traffic, there is nothing wrong, http header followed by \r\n then http response body. I have also noticed that this happens when the response body is short. Testing with browser or python-requests is fine. So it’s not the server error, could it be curl’s problem? Let’s strace it. >> strace -vv curl 'http://localhost:9527/static/a.js' ...... recvfrom(5, "HTTP/1.1 200 OK\r\nServer: YNM3K-9"..., 102400, 0, NULL, NULL) = 443 newfstatat(1, "", {st_dev=makedev(0, 0x1d), st_ino=6, st_mode=S_IFCHR|0620, st_nlink=1, st_uid=1000, st_gid=5, st_blksize=1024, st_blocks=0, st_rdev=makedev(0x88, 0x3), st_atime=1703671640 /* 2023-12-27T18:07:20....

December 27, 2023 · notsobad

Auto open apps on Mac

I poweroff my laptop every night. So I have to open some app I use everyday when I started the laptop. I use a script by Justin Hileman, to open news tabs in terminal. Save this script as init.sh, run sh init.sh in the terminal, and it will do several things: run wg.sh, setup wireguard tunnal open new tab, start a tmux session open new tab, using mosh to ssh a server open new tab, open a txt file using vim open github in chrome start vs code show a popup message #!/bin/bash # # Open new Terminal tabs from the command line # # Author: Justin Hileman (http://justinhileman.com) # # Installation: # Add the following function to your `.bashrc` or `....

December 21, 2023 · notsobad