Databases 12 min read

Can GitLab Run on Distributed Databases? CockroachDB vs YugabyteDB Evaluation

This article evaluates GitLab's compatibility with two PostgreSQL‑compatible distributed databases, CockroachDB and YugabyteDB, by setting up identical environments, running the GitLab setup process, documenting failures and successes, and drawing conclusions about extension support, index compatibility, and overall feasibility.

dbaplus Community
dbaplus Community
dbaplus Community
Can GitLab Run on Distributed Databases? CockroachDB vs YugabyteDB Evaluation

Test Background

GitLab historically supported MySQL and PostgreSQL, but from version 12.1.0 it dropped MySQL support and relies heavily on PostgreSQL features. Large enterprises often run multiple GitLab instances across divisions, creating challenges for unified management, version control, fine‑grained permissions, backup, and infrastructure utilization.

The goal is to determine whether a distributed PostgreSQL‑compatible database can provide a scalable, high‑availability GitLab backend.

Test Environment

CockroachDB and YugabyteDB are two open‑source distributed databases that claim PostgreSQL wire‑protocol compatibility. Their official documentation states:

CockroachDB supports most PostgreSQL syntax and the wire protocol.

YugabyteDB aims to support all PostgreSQL features.

These claims form the basis for a side‑by‑side comparison of GitLab support.

CockroachDB Startup Process

1. Database Initialization

defaultdb=# select version();
 version
-----------------------------------------------------------------------------------------
 CockroachDB CCL v21.2.2 (x86_64-unknown-linux-gnu, built 2021/12/01 14:35:45, go1.16.6)
(1 row)

2. GitLab Information

GitLab information
Version:        12.1.0-ee
Revision:       1f2e6f3f6d8
Directory:      /home/git/gitlab
DB Adapter:     PostgreSQL

3. Database Setup

dc@dc-virtual-machine:/home/git/gitlab$ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
This will create the necessary database tables and seed the database.
You will lose any previous data stored in the database.
Do you want to continue (yes/no)? yes
Dropped database 'gitlab'
Created database 'gitlab'
-- enable_extension("pg_trgm")
rake aborted!
ActiveRecord::StatementInvalid: PG::FeatureNotSupported: ERROR: unimplemented: extension "pg_trgm" is not yet supported
HINT: You have attempted to use a feature that is not yet implemented.
See: https://go.crdb.dev/issue-v/51137/v21.2
: CREATE EXTENSION IF NOT EXISTS "pg_trgm"
/home/git/gitlab/config/initializers/peek.rb:18:in `async_exec_params'

The setup fails because CockroachDB does not yet support PostgreSQL extensions such as pg_trgm. Consequently, no schema objects are created.

Attempting the same steps on CockroachDB v22.1.0 yields the same extension error, indicating the limitation persists in newer releases.

YugabyteDB Startup Process

1. Database Initialization

dc@dc-virtual-machine:/home/git/gitlab$ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
This will create the necessary database tables and seed the database.
You will lose any previous data stored in the database.
Do you want to continue (yes/no)? yes
Dropped database 'gitlab'
Created database 'gitlab'
-- enable_extension("pg_trgm")
-- enable_extension("plpgsql")
-- create_table("abuse_reports", {...})
... (many tables created)
rake aborted!
ActiveRecord::StatementInvalid: PG::InternalError: ERROR: index method "ybgin" not supported yet
HINT: See https://github.com/YugaByte/yugabyte-db/issues/1337
: CREATE INDEX "index_issues_on_description_trigram" ON "issues" USING gin ("description" gin_trgm_ops)

YugabyteDB initially creates extensions and tables successfully, but fails when creating a GIN index because it expects the ybgin index type instead of the standard gin. Upgrading to YugabyteDB v2.13 resolves this issue.

After the upgrade, the setup completes without errors, and the resulting object counts match those of a standard PostgreSQL deployment:

gitlab=# select C.relkind, count(C.relname) from pg_class C left join pg_namespace n on n.oid = C.relnamespace where n.nspname = 'public' group by C.relkind;
 relkind | count
---------+-------
 S | 231
 i | 903
 r | 249
(3 rows)

Test Conclusions

CockroachDB v21.2 and v22.1 lack support for PostgreSQL extensions, causing GitLab initialization to fail.

YugabyteDB v2.9 cannot create GIN indexes, but upgrading to v2.13 adds full GIN support, allowing GitLab to start and function normally.

YugabyteDB supports PostgreSQL extensions; CockroachDB does not.

Next Steps

The plan is to bypass GitLab's automatic database creation, import a pre‑populated standard GitLab database into both CockroachDB and YugabyteDB, and then run a set of read‑write workloads to compare compatibility and performance in real‑world scenarios.

References

PostgreSQL Compatibility – CockroachDB documentation: https://www.cockroachlabs.com/docs/v21.1/postgresql-compatibility.html

YugabyteDB repository: https://github.com/yugabyte/yugabyte-db

GitLabCockroachDBYugabyteDBDatabase testingPostgreSQL Compatibility
dbaplus Community
Written by

dbaplus Community

Enterprise-level professional community for Database, BigData, and AIOps. Daily original articles, weekly online tech talks, monthly offline salons, and quarterly XCOPS&DAMS conferences—delivered by industry experts.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.