btree hash support.
We have using cockroachDB in small projects and we would like to know if index btree hash is going to be implmented because we would love to get that feature.
Regards,
Hi @tatototino! What do you mean by "index btree hash"? Usually btree indexes are different than hash-table indexes. In any case, crdb currently doesn't have either; our indexes are stored in log-structured merge trees (which means that range scans on indexes are efficient). It is possible that we'll implement different types of indexes in the future, but nothing concrete is planned yet.
By the way, a better place for future questions like this is our forum: https://forum.cockroachlabs.com/ This one we can continue discussing here, on github.
I would like to create this sintaxe bellow and cannot create with ON DELETE CASCADE as well.
-- CREATE DATABASE metric_metadata; CREATE USER ddb WITH PASSWORD 'ddb'; CREATE DATABASE metric_metadata OWNER ddb; GRANT ALL ON DATABASE metric_metadata TO ddb; \connect metric_metadata;
CREATE TABLE metrics ( id bigserial PRIMARY key, collection text NOT NULL, metric text[] NOT NULL, bucket text NOT NULL, key text[] NOT NULL ); GRANT ALL On metrics TO ddb; GRANT ALL On metrics_id_seq TO ddb;
CREATE UNIQUE INDEX metrics_idx_id ON metrics (id); CREATE UNIQUE INDEX metrics_idx ON metrics (collection, metric, bucket, key); CREATE UNIQUE INDEX metrics_idx_id_collection ON metrics (id, collection); CREATE INDEX metrics_idx_collection ON metrics USING btree (collection); CREATE INDEX metrics_idx_metric ON metrics USING btree (metric);
CREATE TABLE dimensions ( metric_id bigserial REFERENCES metrics (id) ON DELETE CASCADE, collection text NOT NULL, namespace text NOT NULL, name text NOT NULL, value text NOT NULL, UNIQUE(metric_id, namespace, name) );
GRANT ALL On dimensions TO ddb;
CREATE UNIQUE INDEX dimensions_idx ON dimensions (metric_id, namespace, name, value); CREATE UNIQUE INDEX dimensions_name_idx ON dimensions (metric_id, namespace, name);
CREATE INDEX dimensions_idx_metric_id ON dimensions (metric_id); CREATE INDEX dimensions_idx_namespace_name ON dimensions (namespace, name); CREATE INDEX dimensions_idx_id_namespace ON dimensions (metric_id, namespace); CREATE INDEX dimensions_idx_namespace_name_value ON dimensions USING btree (namespace, name, value); CREATE INDEX dimensions_idx_value ON dimensions USING btree (value); CREATE INDEX dimensions_idx_collection_namespace ON dimensions USING btree (collection, namespace); -- for lookups CREATE INDEX dimensions_idx_collection ON dimensions USING btree (collection); CREATE INDEX dimensions_idx_name ON dimensions USING btree (name); CREATE INDEX dimensions_idx_namespace ON dimensions USING btree (namespace); CREATE INDEX dimensions_idx_collection_namespace_name ON dimensions USING btree (collection, namespace, name); CREATE INDEX dimensions_idx_collection_namespace_name_value ON dimensions USING btree (collection, namespace, name, value);
@tatototino CockroachDB only supports a single indexing method which is equivalent to the Postgres btree indexing method. We don't currently support the USING <method> syntax.
Do you need support for USING hash? If yes, can you expand on what your need is there?
Judging by the original author of this issue, I believe the intended use case is to enable CochroachDB as a drop-in replacement for PostgreSQL together with DalmatinerDB. Related issue: https://gitlab.com/Project-FiFo/DalmatinerDB/dalmatinerdb/issues/127