Technical assignment for benchmarking SQL databases, to test how well these databases support associative operations. At the moment doublets are good only in these requests and support only these requests and we have ready benchmarks with this requests for Doublets and PostgreSQL.
We can use SQL dialect as is for Clickhouse and other databases.
The schema for the Links table is as follows:
CREATE TABLE IF NOT EXISTS Links (
id bigint PRIMARY KEY,
from_id bigint,
to_id bigint
);
Two indexes are created on the Links table:
CREATE INDEX IF NOT EXISTS source ON Links USING btree(from_id);
CREATE INDEX IF NOT EXISTS target ON Links USING btree(to_id);
Links table. The id, from_id, and to_id fields are parameters that need to be provided.INSERT INTO Links VALUES (id, from_id, to_id);
Links table plus one.INSERT INTO Links VALUES (id, id, id);
id: This query updates the from_id and to_id fields for the record with the given id.UPDATE Links SET from_id = new_from_id, to_id = new_to_id WHERE id = given_id;
from_id and to_id: This query updates the from_id and to_id fields for the record that matches the given from_id and to_id.UPDATE Links SET from_id = new_from_id, to_id = new_to_id WHERE from_id = given_from_id AND to_id = given_to_id;