CockroachDB

CockroachDB is its own database type in QueryDesk. It speaks the PostgreSQL wire protocol, so the schema sync, the table structure view, data protection and peer reviews work as they do on PostgreSQL. QueryDesk is tested against CockroachDB 24.3.

Connect a cluster

Add the database as in Connect a database, with these values:

FieldValue
Database typeCockroachDB
Port26257, CockroachDB's default.
Database nameThe database to query, for example defaultdb.

CockroachDB Cloud

The cluster's Connect dialog in the CockroachDB Cloud Console gives a postgresql:// connection string. Choose CockroachDB as the database type first, then paste the string under Update with connection string on the database's settings page and click Apply. The database keeps the CockroachDB type, and QueryDesk reads the string like this:

  • sslmode=verify-full turns on Encryption and Verify server hostname (verify-full).
  • options=--cluster=<routing-id>, which older clusters need to route the connection, becomes an options connection parameter. Every credential on the database sends it.
  • sslrootcert is a file on your computer, so QueryDesk doesn't apply it. Download the CA certificate the Connect dialog offers and paste its contents into Server CA Certificate. QueryDesk verifies the server's certificate against it. Without a CA certificate the connection is encrypted but unverified.

Click Test Connection under the credential to check the connection.

What works differently

  • Analyze isn't offered. CockroachDB's EXPLAIN has no PostgreSQL JSON plan, so the run options have no Analyze query toggle, and an Analyze asked for another way is refused with that reason and runs nothing. EXPLAIN run as a query still returns CockroachDB's own plan, with redacted columns rewritten like any other query.
  • Hidden columns stay out of the schema, the way SELECT * leaves them out. That covers the rowid CockroachDB adds to a table without a primary key, a hash-sharded index's shard column, and columns declared NOT VISIBLE. A query that names one is refused.
  • AI read-only runs an AI query in a read-only transaction that is always rolled back, as on PostgreSQL. CockroachDB refuses a write there, a function's write included.
  • CockroachDB-only syntax is read as a write, and data protection refuses it. That includes AS OF SYSTEM TIME, UPSERT, index hints in braces such as users@{FORCE_INDEX=idx}, SELECT ... FROM [SHOW ...] and RETURNING NOTHING. A plain index hint, users@idx, is redacted and runs without the hint.
  • The JSON structure action needs a protect_json function, and CockroachDB doesn't allow a function to call itself. Setup JSON protection action isn't offered on CockroachDB, and a query on a column with that action fails until the function exists. Use Hide or another action on CockroachDB JSON columns.

Was this page helpful?