Поиск по этому блогу

Показаны сообщения с ярлыком DBA. Показать все сообщения
Показаны сообщения с ярлыком DBA. Показать все сообщения

суббота, 23 февраля 2019 г.

renaming column in ClickHouse

If your CH server supports ALTER TABLE UPDATE(if no, sorry but it's time to migrate to new version)  here is trick:

!Before doing it please test on your test data!



create new column

ALTER TABLE my_super_table
    ADD COLUMN
    new_name UInt32 DEFAULT CAST(0, 'UInt32');


later set value

ALTER TABLE my_super_table
    UPDATE new_name = old_name WHERE 1;

Not sure but I think it's better to wait until you merges are finished

drop column

ALTER TABLE my_super_table
    DROP COLUMN old_name;



That's it!



четверг, 26 апреля 2018 г.

Percona Live 2018


This year I visited US Percona Live 2018. A lot of amazing topics, from my perspective the best one was from ClickHouse Team: "ClickHouse Deep Dive".

Also good ones:
  • "Designing and launching the next-generation database system @ Slack: from whiteboard to production"
  • "The Evolution of Backup/Restore System in Facebook" 



суббота, 20 января 2018 г.

Comparing mydumper vs pure mysqldump

Today I tested mydumper.
It showed very cool results, see below.
Data size + index size is 9054MB. Here is timing of dumping/restoring the same database using mydumper vs mysqldump.
     |  mysqldump/restore dump |mydumper/loader
dump   | real    1m36.642s     |real    0m49.342s
restore| real    32m32.732s     |real    20m32.215s

Also during compilation I faced with issue:
mydumper.c:2814: error: ‘MYSQL_TYPE_JSON’ undeclared (first use in this function)
mydumper.c:2814: error: (Each undeclared identifier is reported only once
mydumper.c:2814: error: for each function it appears in.)
make[2]: *** [CMakeFiles/mydumper/mydumper.c.o] Error 1
make[1]: *** [CMakeFiles/mydumper/all] Error 2
make: *** [all] Error 2
Probably because I am using Percoan 5.6 dev package and JSON data type was introduced only in 5.7. I have commented 2 lines with the 
./mydumper.c: /* if (fields[i].type == MYSQL_TYPE_JSON) g_string_append(statement_row, "CONVERT("); */

./mydumper.c: /* if (fields[i].type == MYSQL_TYPE_JSON) g_string_append(statement_row, " USING UTF8MB4)"); */
I hope it will not affect me unless I am using 5.7+.



четверг, 23 марта 2017 г.