---
title: Getting System Information
description: SQL++ has a system catalog that stores metadata about a database.
  The system catalog is a namespace called system.
pubDate: 2026-08-17T09:53:44.266Z
antora:
  editUrl: https://github.com/couchbaselabs/docs-devex/edit/release/7.2/modules/n1ql/pages/n1ql-intro/sysinfo.adoc
  xref: xref:7.2@server:n1ql:n1ql-intro/sysinfo.adoc[]
---

[Consult the llms.txt file for a full list of contents](/llms.txt)
[View original HTML](/server/7.2/n1ql/n1ql-intro/sysinfo.html)

# Getting System Information

> SQL++ has a system catalog that stores metadata about a database. The system catalog is a namespace called _system_. 

There is a keyspace for each type of artifact. The keyspace names are plural in order to avoid conflicting with SQL++ keywords.

## [](#logical-hierarchy)Logical Hierarchy

SQL++ has the following artifacts:

Datastores

Datastores are similar to sites. A datastore is a database deployment, for example, a server cluster, cloud service, or mobile installation. It is analogous to a relation database instance.

Namespaces

Namespaces are similar to pools. A namespace is a unit of authorization, resource allocation, and tenancy. It is analogous to a relational database or schema. Currently, only the `default` and `system` namespaces are available.

Buckets

A bucket is the fundamental space for storing data in Couchbase Server. Each bucket contains at least one scope by default, and you can create more scopes as required. It is analogous to a relational database table space or file group.

Scopes

A scope is a set of one or more collections. Each scope contains at least one collection by default, and you can create more collections as required. It is analogous to a group of relational database tables.

Collections

A collection is a set of documents that may vary in structure. It is a unit of authorization and resource allocation. It is analogous to a relational database table.

Keyspaces

Keyspaces map to collections in Couchbase Server. A keyspace may be referred to using a full keyspace reference. For example, `` default:`travel-sample`.inventory.airline `` refers to the `airline` collection in the `inventory` scope in the `travel-sample` bucket. A keyspace may also be referred to using a partial keyspace reference, comprising just the collection name. In this case, the namespace, bucket, and scope must be implied by the current [query context](#queriesandresults.adoc#query-context).

For compatibility with legacy versions of Couchbase Server, the name of the scope and collection may be omitted when referring to the default collection in the default scope within a bucket. So for example, we may refer to the `travel-sample` keyspace, meaning the default collection in the default scope in the `travel-sample` bucket.

The term is also used to refer to any of the catalogs in the `system` namespace.

Indexes

An index on a keyspace. It is analogous to a relational database index. Types of indexes include b-tree (ForestDB or MOI) and view indexes.

Dual

The dual keyspace has been added for evaluating constant expressions. It contains a single entry with no attributes.

## [](#querying-datastores)Querying Datastores

You can query datastores using the `system:datastores` keyspace as follows:

```sqlpp
SELECT * FROM system:datastores
```

The query returns the following attributes:

| id  | (string) ID of the datastore           |
| --- | -------------------------------------- |
| url | (string) URL of the datastore instance |

## [](#querying-namespaces)Querying Namespaces

You can query namespaces using the `system:namespaces` keyspace as follows:

```sqlpp
SELECT * FROM system:namespaces
```

The query returns the following attributes:

| id            | (string) ID of the namespace                                |
| ------------- | ----------------------------------------------------------- |
| name          | (string) Name of the namespace                              |
| datastore\_id | (string) ID of the datastore to which the namespace belongs |

## [](#querying-buckets)Querying Buckets

You can query buckets using the `system:buckets` keyspace as follows:

```sqlpp
SELECT * FROM system:buckets
```

The query returns the following attributes:

| datastore\_id | (string) ID of the datastore to which the bucket belongs |
| ------------- | -------------------------------------------------------- |
| name          | (string) Name of the bucket                              |
| namespace     | (string) Namespace to which the bucket belongs           |
| namespace\_id | (string) ID of the namespace to which the bucket belongs |
| path          | (string) Path of the bucket                              |

## [](#querying-scopes)Querying Scopes

You can query scopes using the `system:scopes` keyspace as follows:

```sqlpp
SELECT * FROM system:scopes
```

The query returns the following attributes:

| bucket        | (string) Bucket to which the scope belongs              |
| ------------- | ------------------------------------------------------- |
| datastore\_id | (string) ID of the datastore to which the scope belongs |
| name          | (string) Name of the scope                              |
| namespace     | (string) Namespace to which the scope belongs           |
| namespace\_id | (string) ID of the namespace to which the scope belongs |
| path          | (string) Path of the scope                              |

> [!NOTE]
> Querying `system:scopes` only returns named scopes — that is, non-default scopes. To return all scopes, including the default scopes, you can query `system:all_scopes`.

## [](#querying-keyspaces)Querying Collections

You can query collections using the `system:keyspaces` keyspace as follows:

```sqlpp
SELECT * FROM system:keyspaces
```

For the default collection in the default scope, the query returns the following attributes:

| datastore\_id | (string) ID of the datastore to which the keyspace belongs |
| ------------- | ---------------------------------------------------------- |
| id            | (string) ID of the bucket to which the keyspace belongs    |
| name          | (string) Bucket to which the keyspace belongs              |
| namespace     | (string) Namespace to which the keyspace belongs           |
| namespace\_id | (string) ID of the namespace to which the keyspace belongs |
| path          | (string) Path of the keyspace                              |

For a named, non-default collection, the query returns the following attributes:

| bucket        | (string) Bucket to which the keyspace belongs              |
| ------------- | ---------------------------------------------------------- |
| datastore\_id | (string) ID of the datastore to which the keyspace belongs |
| id            | (string) ID of the keyspace                                |
| name          | (string) Name of the keyspace                              |
| namespace     | (string) Namespace to which the keyspace belongs           |
| namespace\_id | (string) ID of the namespace to which the keyspace belongs |
| path          | (string) Path of the keyspace                              |
| scope         | (string) Scope to which the keyspace belongs               |

> [!NOTE]
> Querying `system:keyspaces` only returns non-system keyspaces. To return all keyspaces, including the system keyspaces, you can query `system:all_keyspaces`.

## [](#querying-indexes)Querying Indexes

You can query indexes using the `system:indexes` keyspace as follows:

```sqlpp
SELECT * FROM system:indexes
```

For an index on the default collection in the default scope, the query returns the following attributes:

| condition     | (string) Index filter, if present                       |
| ------------- | ------------------------------------------------------- |
| datastore\_id | (string) ID of the datastore to which the index belongs |
| id            | (string) ID of the index                                |
| index\_key    | (array of strings) List of index keys                   |
| is\_primary   | (boolean) True if the index is a primary index          |
| keyspace\_id  | (string) ID of the bucket to which the index belongs    |
| name          | (string) Name of the index                              |
| namespace\_id | (string) ID of the namespace to which the index belongs |
| state         | (string) State of index, for example, online            |
| using         | (string) Type of index, for example, gsi                |

For an index on a named, non-default collection, the query returns the following attributes:

| bucket\_id    | (string) ID of the bucket to which the index belongs    |
| ------------- | ------------------------------------------------------- |
| condition     | (string) Index filter, if present                       |
| datastore\_id | (string) ID of the datastore to which the index belongs |
| id            | (string) ID of the index                                |
| index\_key    | (array of strings) List of index keys                   |
| is\_primary   | (boolean) True if the index is a primary index          |
| keyspace\_id  | (string) ID of the keyspace to which the index belongs  |
| name          | (string) Name of the index                              |
| namespace\_id | (string) ID of the namespace to which the index belongs |
| state         | (string) State of index, for example, online            |
| using         | (string) Type of index, for example, gsi                |

> [!NOTE]
> Querying `system:indexes` only returns indexes on non-system keyspaces. To return all indexes, including indexes on system keyspaces, you can query `system:all_indexes`.

## [](#querying-dual)Querying Dual

You can use dual to evaluate constant expressions.

```sqlpp
SELECT 2+5 FROM system:dual
```

The query returns the result of the expression, 7 in this case.

## [](#related-links)Related Links

* Refer to [Monitor Queries](../../manage/monitor/monitoring-n1ql-query.md) for more information on the system namespace.