Open fabiog1901 opened 2 years ago
I was initially worried about the insert case of the upsert because I incorrectly assumed we'd have to insert a NULL value for the other column families, which would require a read to determine if it is an insert case. But we don't insert KVs for column families that have all NULL columns, so I think we should be fine:
statement ok
CREATE TABLE t (
a INT PRIMARY KEY,
b INT,
c INT,
FAMILY (a, b),
FAMILY (c)
)
query T kvtrace
INSERT INTO t (a, b) VALUES (2, 20)
----
CPut /Table/106/1/2/0 -> /TUPLE/2:2:Int/20
Some additional requirements:
When planning an UPSERT specifying all columns in the column family, the opt also plans a
scan
instead of doing the fast-path.The goal is to replace an UPDATE with an UPSERT in order to save time on the read part of the Update. By putting all to-be-updated columns in its own column family, and specifying just those columns in the upsert, the expectation is to use the fast-path and avoid the
scan
.There is no
scan
if upserting ALL columnsIt will do a
scan
even though the 3 cols are contained within a family, 'main'.Jira issue: CRDB-18999
gz#14308