ClickHouse / ClickHouse/clickhouse-go

`SELECT toString(number) FROM numbers(500000000)` is slow

Open
#633 7 comments 0 reactions 1 assignee Claimed by @gingerwizard View on GitHub
bug
Dominant language
Go
Stars
3.3k
Forks
680
Avg merge
2d 3h
Merged PRs (30d)
14

Description

### Issue description
Using benchmark at [here](https://github.com/go-faster/ch-bench/blob/main/ch-bench-official/main.go), I found somehow `SELECT toString(number) FROM numbers(500000000)` is very slow on my VM. Changing type to Decimal may have similar issue.

Query
Result

SELECT number FROM numbers(500000000)



5.6s 500000000
Command being timed: "go run main.go"
User time (seconds): 5.19
System time (seconds): 3.99
Percent of CPU this job got: 154%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.92
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 90576
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 1
Minor (reclaiming a frame) page faults: 64764
Voluntary context switches: 36844
Involuntary context switches: 15003
Swaps: 0
File system inputs: 8
File system outputs: 96
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0

SELECT toString(number) FROM numbers(500000000)



1m30.674s 500000000
Command being timed: "go run main.go"
User time (seconds): 89.83
System time (seconds): 55.28
Percent of CPU this job got: 159%
Elapsed (wall clock) time (h:mm:ss or m:ss): 1:31.05
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 89944
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 1
Minor (reclaiming a frame) page faults: 613890
Voluntary context switches: 165692
Involuntary context switches: 51110
Swaps: 0
File system inputs: 0
File system outputs: 16
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0

### Example code
https://github.com/go-faster/ch-bench/blob/c2627b1d0fa1a8abc7d3560816d3b919b983600b/ch-bench-official/main.go#L26

### Error log
N/A

### Configuration
*OS:* Linux myserver 5.18.5-100.fc35.x86_64 # 1 SMP PREEMPT_DYNAMIC Thu Jun 16 14:44:38 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

*Interface:* E.g. `native`, `database/sql`

*Driver version:* v2.1.0

*Go version:* 1.18.3

*ClickHouse Server version:* 22.3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.