View clickhouse-client-sample.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Put it to ~/.clickhouse-client/config.xml --> | |
<yandex> | |
<config-file></config-file> | |
<stacktrace>false<stacktrace> | |
<format>Vertical</format> | |
<format_max_block_size>10000</format_max_block_size> | |
<insert_format_max_block_size>100000</insert_format_max_block_size> | |
<progress>false</progress> | |
<echo>false</echo> | |
<use_client_time_zone>false</use_client_time_zone> |
View geoip2_bench.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Time::HiRes; | |
use GeoIP2::Database::Reader; | |
my $reader = GeoIP2::Database::Reader->new( | |
file => '/usr/local/www/maxminddb/GeoIP2-City.mmdb', | |
locales => [ 'en' ] | |
); |
View geoip2_bench2.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## GeoIP2::Database::Reader vs MaxMind::DB::Reader benchmark or | |
## why you shouldn't use GeoIP2::Database::Reader | |
use Benchmark (cmpthese); | |
use strict; | |
use warnings; | |
use GeoIP2::Database::Reader; | |
use MaxMind::DB::Reader; |
View sample.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- adding braces around partition name (even for simple types) allows to do cast safely | |
:) create table xxx(d Date, a UInt8) Engine = MergeTree() PARTITION by d ORDER BY a; | |
CREATE TABLE xxx | |
( | |
d Date, | |
a UInt8 | |
) | |
ENGINE = MergeTree() | |
PARTITION BY d |
View prewhere.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT version() | |
┌─version()─┐ | |
│ 1.1.54380 │ | |
└───────────┘ | |
SELECT * | |
FROM system.settings | |
WHERE name LIKE '%prewh%'; | |
┌─name──────────────────────┬─value─┬─changed─┬─description───────────────────────────────────────────────────────────────────────┐ |
View csv2tsv.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import csv, sys | |
csv.register_dialect('clickhouse', escapechar="\\", doublequote=0, quotechar='\'',skipinitialspace = 0,delimiter = '\t', quoting=csv.QUOTE_NONE, lineterminator='\n') | |
csv.writer(sys.stdout, dialect='clickhouse').writerows(csv.reader(sys.stdin)) | |
# install: | |
# put in $PATH | |
# chmod +x csv2tsv.py | |
# usage: |
View matview_block_size.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE mat_vew_src | |
( | |
id UInt64, | |
number UInt64 | |
) | |
ENGINE = MergeTree | |
PARTITION BY tuple() | |
ORDER BY id | |
-- Ok. |
View gist:cd9c41f8eff1f0900312d90e51fbb081
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Download https://gallery.technet.microsoft.com/scriptcenter/Grant-Revoke-Query-user-26e259b0#content | |
2. powershell as admin | |
3. | |
Import-Module .\UserRights.psm1 | |
Grant-UserRight -Account "BUILTIN\Users" -Right SeCreateSymbolicLink | |
Get-AccountsWithUserRight -Right SeCreateSymbolicLink | |
Account Right SID | |
------- ----- --- |
View list_partitions.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select 'ALTER TABLE '||database||'.'||table||' DETACH PARTITION '||partition||';' from system.parts group by database,table,partition ORDER BY database, table, partition FORMAT TSVRaw; |
View check_different_presets.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL='http://127.0.0.1:8123/ping' | |
EXTRA='' | |
echo 'query,extra,concurrency,threads,time_started,min_req,max_req,mean_req,req_stdev,min_latency,max_latency,mean_latency,latency_stdev,50th,75th,90th,99th,99.999th,duration,requests,bytes,connect_errors,read_errors,write_errors,status_errors,timeouts' > result.csv | |
for CONCURRENCY in 1 2 4 8 16 32 64 128 256 512 768 1024 1280 1536 1792 2048 | |
do | |
if (( $CONCURRENCY < 8 )); then | |
THREADS=$CONCURRENCY |
OlderNewer