Posts

Showing posts from January, 2022

CockroachDB TIL: Volume 5

Image
This is my series of articles covering short "Today I learned" topics as I work with CockroachDB. Previous articles Volume 1 Volume 2 Volume 3 Volume 4 Volume 5 Volume 6 Volume 7 Topics Topic 1 Multi-row updates There's a multi-row insert, upsert and delete. I've not heard of multi-row update. To my surprise, Postgresql support multi-row update with the following syntax: UPDATE FROM . It sends several rows in a single batch, thereby improving performance and reducing network hops. CREATE TABLE t1 (key INT PRIMARY KEY , val1 STRING, val2 STRING); INSERT INTO t1 (key, val1, val2) VALUES ( 1 , 'a' , 'b' ), ( 2 , 'c' , 'd' ), ( 3 , 'e' , 'f' ); SELECT * FROM t1; key | val1 | val2 ------+------+------- 1 | a | b 2 | c | d 3 | e | f UPDATE t1 AS t SET val1 = t2.val1, val2 = t2.val2 FROM ( VALUES ( 1 , 'aa' , 'bb...

Data federation with CockroachDB and Presto

Image

Migrating feature toggles with Unleash and CockroachDB

Image