diff --git a/modules/guides/pages/cbo.adoc b/modules/guides/pages/cbo.adoc index 041ccefda..eb1c7633d 100644 --- a/modules/guides/pages/cbo.adoc +++ b/modules/guides/pages/cbo.adoc @@ -224,7 +224,7 @@ Reference: Administrator guides: * xref:manage:manage-settings/general-settings.adoc[General Settings] -* xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-dictionary[Monitor Statistics] +* xref:n1ql:n1ql-intro/sysinfo.adoc#sys-dictionary[Monitor Statistics] Querying with SDKs: diff --git a/modules/n1ql/pages/n1ql-intro/queriesandresults.adoc b/modules/n1ql/pages/n1ql-intro/queriesandresults.adoc index b76520519..c61da6b43 100644 --- a/modules/n1ql/pages/n1ql-intro/queriesandresults.adoc +++ b/modules/n1ql/pages/n1ql-intro/queriesandresults.adoc @@ -72,18 +72,62 @@ SELECT name, brewery_id from `beer-sample` WHERE brewery_id IS NOT MISSING LIMIT } ---- -[#keyspace-reference] -== Keyspace References +[#logical-hierarchy] +== Logical Hierarchy Couchbase stores data within a xref:learn:data/scopes-and-collections.adoc[logical hierarchy] of buckets, scopes, and collections. This enables separation between documents of different types. + +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. +You must refer to a keyspace using a <>. ++ +The term keyspace is also used to refer to any of the catalogs in the xref:n1ql:n1ql-intro/sysinfo.adoc[system] namespace. + +[#keyspace-reference] +== Keyspace References + For most queries, you must provide one or more keyspace references to specify the data sources for the query. A keyspace reference may be: -* A _full_ keyspace reference: a path comprising the bucket, the scope, and the collection which contains the documents you want. +* A [dfn]#full keyspace reference#: a path comprising the optional namespace, the bucket, the scope, and the collection which contains the documents you want. +For example, `default:{backtick}travel-sample{backtick}.inventory.airline`. -* A _partial_ keyspace reference, comprising the collection name only. +* A [dfn]#partial keyspace reference#, comprising the collection name only. +For example, `airline`. When a query contains partial keyspace references, you must set the <> to specify a bucket and scope before running a query. Partial keyspace references are resolved using the bucket and scope supplied by the query context. @@ -94,7 +138,7 @@ In this case, the <> must not be set. [#query-context] == Query Context -The [def]_query context_ specifies the the namespace, bucket, and scope used to resolve partial keyspace references. +The [dfn]#query context# specifies the the namespace, bucket, and scope used to resolve partial keyspace references. When the query context is set, you can refer to a collection using just the collection name, without having to enter the keyspace path. When the query context is not set, it defaults to the `default` namespace, with no bucket, scope, or collection. @@ -111,10 +155,10 @@ This can be used to support the separation of tenant data in a multi-tenancy env -- [#paths] -== Paths +== Sub-Document Paths One of the main differences between JSON and flat rows is that JSON supports a nested structure, allowing documents to contain other documents, also known as sub-documents. -{sqlpp} provides [.term]_paths_ to support nested data. +{sqlpp} provides [dfn]#sub-document paths# to support nested data. Paths use dot notation syntax to identify the logical location of an attribute within a document. For example, to get the street from a customer order, use the path `orders.billTo.street`. This path refers to the value for `street` in the `billTo` object. @@ -151,13 +195,13 @@ To set query parameter values when you run the query, use the cbq query shell, t For more information and examples, refer to xref:n1ql:n1ql-manage/query-settings.adoc#section_srh_tlm_n1b[Named Parameters and Positional Parameters]. [#prepare-stmts] -== Query Optimization Using Prepared Statements +== Prepared Statements When a {sqlpp} query is sent to the server, the server inspects the query and parses it, planning which indexes to use, if any. -Once this is done, it generates a _query plan_. +Once this is done, it generates a [dfn]#query plan#. The computation for the plan adds some additional processing time and overhead for the query. -You can _prepare_ a frequently-used query so that its plan is generated only once. +You can [dfn]#prepare# a frequently-used query so that its plan is generated only once. Subsequent queries using the same query string will use the pre-generated plan instead, saving on the overhead and processing of the plan each time. NOTE: Parameterized queries are considered the same query for caching and planning purposes, even if the supplied parameters are different. @@ -172,10 +216,10 @@ This allows specific data (for example, specific fields) to be retrieved quickly The Index service enables you to create two types of index: primary indexes and global secondary indexes. -* You can define a _primary index_ on a keyspace. +* You can define a [dfn]#primary index# on a keyspace. Primary indexes are based on the unique key of every item in a specified collection. A primary index is intended to be used for simple queries, which have no filters or predicates. -* You can also create a _secondary index_ on specific fields in a keyspace. +* You can also create a [dfn]#secondary index# on specific fields in a keyspace. Secondary indexes, often referred to as Global Secondary Indexes or GSIs, constitute the principal means of indexing documents to be accessed by the Query service. + For example, creating a secondary index on the `name` and `email` fields in the `users` keyspace would allow you to query the keyspace regarding a document's `name` or `email` properties. diff --git a/modules/n1ql/pages/n1ql-intro/sysinfo.adoc b/modules/n1ql/pages/n1ql-intro/sysinfo.adoc index 63e154519..db3fb4399 100644 --- a/modules/n1ql/pages/n1ql-intro/sysinfo.adoc +++ b/modules/n1ql/pages/n1ql-intro/sysinfo.adoc @@ -1,74 +1,66 @@ = Get System Information :page-topic-type: concept -:description: {sqlpp} has a system namespace that stores metadata about data containers. \ -You can query the system namespace to get information about the data containers. +:description: {sqlpp} has a system namespace that stores metadata about data containers, the Query service, and the system as a whole. \ +You can query the system namespace to get this information. [abstract] {description} include::ROOT:partial$component-signpost.adoc[] -There is a catalog for each type of data container. -The catalog names are plural in order to avoid conflicting with {sqlpp} keywords. +Within the `system` namespace, the following catalogs are provided. +Most catalog names are plural in order to avoid conflicting with {sqlpp} keywords. -== Logical Hierarchy - -With the `system` namespace, you can get information about following types of data container: - -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:: +[cols="4"] +|=== +| Data Containers | Monitoring Catalogs | Security Catalogs | Other + +a| [%hardbreaks] +<> +<> +<> +<> +<> +<> +<> + +a| [%hardbreaks] +xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#vitals[system:vitals] +xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-active-req[system:active_requests] +xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-prepared[system:prepareds] +xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-completed-req[system:completed_requests] + +a| [%hardbreaks] +<> +<> +<> +<> + +a| [%hardbreaks] +<> +<> +<> +<> +<> +<> +<> +<> +|=== -Keyspaces map to collections in Couchbase Server. -A keyspace may be referred to using a full keyspace reference. -For example, `default:{backtick}travel-sample{backtick}.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 xref:queriesandresults.adoc#query-context[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. +== Authentication and Client Privileges -Indexes:: +Client applications must be authenticated with sufficient privileges to access system keyspaces. -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. +* Users must have the *Query System Catalog* role to access restricted system keyspaces. +For more details about user roles, see xref:learn:security/authorization-overview.adoc[Authorization]. -Dual:: +* In addition, users must have permission to access a bucket, scope, or collection to be able to view that item in the system catalog. +Similarly, users must have SELECT permission on the target of an index to be able to view that index in the system catalog. -The dual catalog has been added for evaluating constant expressions. -It contains a single entry with no attributes. +* The following system keyspaces are considered open, that is, all users can access them without any special privileges: + ** `system:dual` + ** `system:datastores` + ** `system:namespaces` [#querying-datastores] == Query Datastores @@ -432,6 +424,1192 @@ SELECT 2+5 FROM system:dual The query returns the result of the expression, 7 in this case. +[#sys_my-user-info] +== Monitor Your User Info + +The `system:my_user_info` catalog maintains a list of all information of your profile. + +To see your current information, use: + +[source,sqlpp] +---- +SELECT * FROM system:my_user_info; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "my_user_info": { + "domain": "local", + "external_groups": [], + "groups": [], + "id": "jane", + "name": "Jane Doe", + "password_change_date": "2019-05-07T02:31:53.000Z", + "roles": [ + { + "origins": [ + { + "type": "user" + } + ], + "role": "admin" + } + ] + } + } +] +---- + +[#sys-user-info] +== Monitor All User Info + +The `system:user_info` catalog maintains a list of all current users in your bucket and their information. + +To see the list of all current users, use: + +[source,sqlpp] +---- +SELECT * FROM system:user_info; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "user_info": { + "domain": "local", + "external_groups": [], + "groups": [], + "id": "jane", + "name": "Jane Doe", + "password_change_date": "2019-05-07T02:31:53.000Z", + "roles": [ + { + "origins": [ + { + "type": "user" + } + ], + "role": "admin" + } + ] + } + }, + { + "user_info": { + "domain": "ns_server", + "id": "Administrator", + "name": "Administrator", + "roles": [ + { + "role": "admin" + } + ] + } + } +] +---- + +[#sys-nodes] +== Monitor Nodes + +The `system:nodes` catalog shows the datastore topology information. +This is separate from the Query clustering view, in that Query clustering shows a map of the Query cluster, as provided by the cluster manager, while `system:nodes` shows a view of the nodes and services that make up the actual datastore, which may or may not include Query nodes. + +* The dichotomy is important in that Query nodes could be clustered by one entity (e.g. Zookeeper) and be connected to a clustered datastore (e.g. Couchbase) such that each does not have visibility of the other. +* Should {sqlpp} be extended to be able to concurrently connect to multiple datastores, each datastore will report its own topology, so that `system:nodes` offers a complete view of all the storage nodes, whatever those may be. +* The `system:nodes` keyspace provides a way to report services advertised by each node as well as services that are actually running. +This is datastore dependent. +* Query clustering is still reported by the `/admin` endpoints. + +To see the list of all current node information, use: + +[source,sqlpp] +---- +SELECT * FROM system:nodes; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "nodes": { + "name": "127.0.0.1:8091", + "ports": { + "cbas": 8095, + "cbasAdmin": 9110, + "cbasCc": 9111, + "cbasSSL": 18095, + "eventingAdminPort": 8096, + "eventingSSL": 18096, + "fts": 8094, + "ftsSSL": 18094, + "indexAdmin": 9100, + "indexHttp": 9102, + "indexHttps": 19102, + "indexScan": 9101, + "indexStreamCatchup": 9104, + "indexStreamInit": 9103, + "indexStreamMaint": 9105, + "kv": 11210, + "kvSSL": 11207, + "n1ql": 8093, + "n1qlSSL": 18093 + }, + "services": [ + "cbas", + "eventing", + "fts", + "index", + "kv", + "n1ql" + ] + } + } +] +---- + +[#sys-app-roles] +== Monitor Applicable Roles + +The `system:applicable_roles` catalog maintains a list of all applicable roles and grantee of each bucket. + +To see the list of all current applicable role information, use: + +[source,sqlpp] +---- +SELECT * FROM system:applicable_roles; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "applicable_roles": { + "grantee": "anil", + "role": "replication_admin" + } + }, + { + "applicable_roles": { + "bucket_name": "travel-sample", + "grantee": "anil", + "role": "select" + } + }, + { + "applicable_roles": { + "bucket_name": "*", + "grantee": "anil", + "role": "select" + } + } +] +---- + +For more examples, take a look at the blog: https://blog.couchbase.com/optimize-n1ql-performance-using-request-profiling/[Optimize {sqlpp} performance using request profiling^]. + +[#sys-dictionary] +== Monitor Statistics + +The `system:dictionary` catalog maintains a list of the on-disk optimizer statistics stored in the `_query` collection within the `_system` scope. + +If you have multiple query nodes, the data retrieved from this catalog will be the same, regardless of the node on which you run the query. + +To see the list of on-disk optimizer statistics, use: + +[source,sqlpp] +---- +SELECT * FROM system:dictionary; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "dictionary": { + "avgDocKeySize": 12, + "avgDocSize": 278, + "bucket": "travel-sample", + "distributionKeys": [ + "airportname", + "faa", + "city" + ], + "docCount": 1968, + "indexes": [ + { + "indexId": "bc3048e87bf84828", + "indexName": "def_inventory_airport_primary", + "indexStats": [ + { + "avgItemSize": 24, + "avgPageSize": 11760, + "numItems": 1968, + "numPages": 4, + "resRatio": 1 + } + ] + }, + // ... + ], + "keyspace": "airport", + "namespace": "default", + "scope": "inventory" + } + }, + // ... +] +---- + +This catalog contains an array of dictionaries, one for each keyspace for which optimizer statistics are available. +Each dictionary gives the following information: + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**avgDocKeySize** + +__required__ +|Average doc key size. +|Integer + +|**avgDocSize** + +__required__ +|Average doc size. +|Integer + +|**bucket** + +__required__ +|The bucket for which statistics are available. +|String + +|**keyspace** + +__required__ +|The keyspace for which statistics are available. +|String + +|**namespace** + +__required__ +|The namespace for which statistics are available. +|String + +|**scope** + +__required__ +|The scope for which statistics are available. +|String + +|**distributionKeys** + +__required__ +|Distribution keys for which histograms are available. +|String array + +|**docCount** + +__required__ +|Document count. +|Integer + +|**indexes** + +__required__ +|An array of indexes in this keyspace for which statistics are available. +|<> array + +|**node** + +__required__ +|The query node where this dictionary cache is resident. +|String +|=== + +[[indexes]] +**Indexes** + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**indexId** + +__required__ +|The index ID. +|String + +|**indexName** + +__required__ +|The index name. +|String + +|**indexStats** + +__required__ +|An array of statistics for each index, with one element for each index partition. +|<> array +|=== + +[[indexStats]] +**Index Statistics** + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**avgItemSize** + +__required__ +|Average item size. +|Integer + +|**avgPageSize** + +__required__ +|Average page size. +|Integer + +|**numItems** + +__required__ +|Number of items. +|Integer + +|**numPages** + +__required__ +|Number of pages. +|Integer + +|**resRatio** + +__required__ +|Resident ratio. +|Integer +|=== + +For further details, see xref:n1ql:n1ql-language-reference/updatestatistics.adoc[]. + +[#sys-dictionary-cache] +== Monitor Cached Statistics + +The `system:dictionary_cache` catalog maintains a list of the in-memory cached subset of the optimizer statistics. + +If you have multiple query nodes, the data retrieved from this node shows cached optimizer statistics from all nodes. +Individual nodes may have a different subset of cached information. + +To see the list of in-memory optimizer statistics, use: + +[source,sqlpp] +---- +SELECT * FROM system:dictionary_cache; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "dictionary_cache": { + "avgDocKeySize": 12, + "avgDocSize": 278, + "bucket": "travel-sample", + "distributionKeys": [ + "airportname", + "faa", + "city" + ], + "docCount": 1968, + "indexes": [ + { + "indexId": "bc3048e87bf84828", + "indexName": "def_inventory_airport_primary", + "indexStats": [ + { + "avgItemSize": 24, + "avgPageSize": 11760, + "numItems": 1968, + "numPages": 4, + "resRatio": 1 + } + ] + }, + // ... + ], + "keyspace": "airport", + "namespace": "default", + "node": "172.23.0.3:8091", + "scope": "inventory" + } + }, + // ... +] +---- + +This catalog contains an array of dictionary caches, one for each keyspace for which optimizer statistics are available. +Each dictionary cache gives the same information as the <> catalog. + +For further details, see xref:n1ql:n1ql-language-reference/updatestatistics.adoc[]. + +[#sys-functions] +== Monitor Functions + +The `system:functions` catalog maintains a list of all user-defined functions across all nodes. +To see the list of all user-defined functions, use: + +[source,sqlpp] +---- +SELECT * FROM system:functions; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "functions": { + "definition": { + "#language": "inline", + "expression": "(((`fahrenheit` - 32) * 5) / 9)", + "parameters": [ + "fahrenheit" + ], + "text": "((fahrenheit - 32) * 5/9)" + }, + "identity": { + "bucket": "travel-sample", + "name": "celsius", + "namespace": "default", + "scope": "inventory", + "type": "scope" + } + } + }, + { + "functions": { + "definition": { + "#language": "javascript", + "library": "geohash-js", + "name": "geohash-js", + "object": "calculateAdjacent", + "parameters": [ + "src", + "dir" + ] + }, + "identity": { + "name": "adjacent", + "namespace": "default", + "type": "global" + } + } + }, + // ... +] +---- + +This catalog contains the following attributes: + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**definition** + +__required__ +|The definition of the function. +|<> object + +|**identity** + +__required__ +|The identity of the function. +|<> object +|=== + +[[definition]] +**Definition** + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**#language** + +__required__ +|The language of the function. + +*Example*: `inline` +|String + +|**parameters** + +__required__ +|The parameters required by the function. +|String array + +|**expression** + +__optional__ +|For inline functions only: the expression defining the function. +|String + +|**text** + +__optional__ +|For inline functions: the verbatim text of the function. + +''' + +For {sqlpp} managed user-defined functions: the external code defining the function. +|String + +|**library** + +__optional__ +|For external functions only: the library containing the function. +|String + +|**name** + +__optional__ +|For external functions only: the relative name of the library. +|String + +|**object** + +__optional__ +|For external functions only: the object defining the function. +|String +|=== + +[[identity]] +**Identity** + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**name** + +__required__ +|The name of the function. +|String + +|**namespace** + +__required__ +|The namespace of the function. + +*Example*: `default` +|String + +|**type** + +__required__ +|The type of the function. + +*Example*: `global` +|String + +|**bucket** + +__optional__ +|For scoped functions only: the bucket containing the function. +|String + +|**scope** + +__optional__ +|For scoped functions only: the scope containing the function. +|String +|=== + +[#sys-functions-cache] +== Monitor Cached Functions + +The `system:functions_cache` catalog maintains a list of recently-used user-defined functions across all nodes. +The catalog also lists user-defined functions that have been called recently, but do not exist. +To see the list of recently-used user-defined functions, use: + +[source,sqlpp] +---- +SELECT * FROM system:functions_cache; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "functions_cache": { + "#language": "inline", + "avgServiceTime": "3.066847ms", + "expression": "(((`fahrenheit` - 32) * 5) / 9)", + "lastUse": "2022-03-09 00:17:59.60659793 +0000 UTC m=+35951.429537902", + "maxServiceTime": "3.066847ms", + "minServiceTime": "0s", + "name": "celsius", + "namespace": "default", + "node": "127.0.0.1:8091", + "parameters": [ + "fahrenheit" + ], + "scope": "inventory", + "text": "((fahrenheit - 32) * 5/9)", + "type": "scope", + "uses": 1 + } + }, + { + "functions_cache": { + "#language": "javascript", + "avgServiceTime": "56.892636ms", + "lastUse": "2022-03-09 00:15:46.289934029 +0000 UTC m=+35818.007560703", + "library": "geohash-js", + "maxServiceTime": "146.025426ms", + "minServiceTime": "0s", + "name": "geohash-js", + "namespace": "default", + "node": "127.0.0.1:8091", + "object": "calculateAdjacent", + "parameters": [ + "src", + "dir" + ], + "type": "global", + "uses": 4 + } + }, + { + "functions_cache": { + "avgServiceTime": "3.057421ms", + "lastUse": "2022-03-09 00:17:25.396840275 +0000 UTC m=+35917.199008929", + "maxServiceTime": "3.057421ms", + "minServiceTime": "0s", + "name": "notFound", + "namespace": "default", + "node": "127.0.0.1:8091", + "type": "global", + "undefined_function": true, + "uses": 1 + } + } +] +---- + +This catalog contains the following attributes: + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**#language** + +__required__ +|The language of the function. + +*Example*: `inline` +|String + +|**name** + +__required__ +|The name of the function. +|String + +|**namespace** + +__required__ +|The namespace of the function. + +*Example*: `default` +|String + +|**parameters** + +__required__ +|The parameters required by the function. +|String array + +|**type** + +__required__ +|The type of the function. + +*Example*: `global` +|String + +|**scope** + +__optional__ +|For scoped functions only: the scope containing the function. +|String + +|**expression** + +__optional__ +|For inline functions only: the expression defining the function. +|String + +|**text** + +__optional__ +|For inline functions: the verbatim text of the function. + +''' + +For {sqlpp} managed user-defined functions: the external code defining the function. +|String + +|**library** + +__optional__ +|For external functions only: the library containing the function. +|String + +|**object** + +__optional__ +|For external functions only: the object defining the function. +|String + +|**avgServiceTime** + +__required__ +|The mean service time for the function. +|String + +|**lastUse** + +__required__ +|The date and time when the function was last used. +|String + +|**maxServiceTime** + +__required__ +|The maximum service time for the function. +|String + +|**minServiceTime** + +__required__ +|The minimum service time for the function. +|String + +|**node** + +__required__ +|The query node where the function is cached. +|String + +|**undefined_function** + +__required__ +|Whether the function exists or is undefined. +|Boolean + +|**uses** + +__required__ +|The number of uses of the function. +|Number +|=== + +Each query node keeps its own cache of recently-used user-defined functions, so you may see the same function listed for multiple nodes. + +[#sys-tasks-cache] +== Monitor Cached Tasks + +The `system:tasks_cache` catalog maintains a list of recently-used scheduled tasks, such as index advisor sessions. +To see the list of recently-used scheduled tasks, use: + +[source,sqlpp] +---- +SELECT * FROM system:tasks_cache; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "tasks_cache": { + "class": "advisor", + "delay": "1h0m0s", + "id": "bcd9f8e4-b324-504c-a98b-ace90dba869f", + "name": "aa7f688a-bf29-438f-888f-eeaead87ca40", + "node": "10.143.192.101:8091", + "state": "scheduled", + "subClass": "analyze", + "submitTime": "2019-09-17 05:18:12.903122381 -0700 PDT m=+8460.550715992" + } + }, + { + "tasks_cache": { + "class": "advisor", + "delay": "5m0s", + "id": "254abec5-5782-543e-9ee0-d07da146b94e", + "name": "ca2cfe56-01fa-4563-8eb0-a753af76d865", + "node": "10.143.192.101:8091", + "results": [ + // ... + ], + "startTime": "2019-09-17 05:03:31.821597725 -0700 PDT m=+7579.469191487", + "state": "completed", + "stopTime": "2019-09-17 05:03:31.963133954 -0700 PDT m=+7579.610727539", + "subClass": "analyze", + "submitTime": "2019-09-17 04:58:31.821230131 -0700 PDT m=+7279.468823737" + } + } +] +---- + +This catalog contains the following attributes: + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**class** + +__required__ +|The class of the task. + +*Example*: ``advisor`` +|string + +|**delay** + +__required__ +|The scheduled duration of the task. +|string + +|**id** + +__required__ +|The internal ID of the task. +|string + +|**name** + +__required__ +|The name of the task. +|string + +|**node** + +__required__ +|The node where the task was started. +|string + +|**state** + +__required__ +|The state of the task. + +*Values*: `scheduled`, `cancelled`, `completed` +|string + +|**subClass** + +__required__ +|The subclass of the task. + +*Example*: `analyze` +|string + +|**submitTime** + +__required__ +|The date and time when the task was submitted. +|string + +|**results** + +__optional__ +|Not scheduled tasks: the results of the task. +|Any array + +|**startTime** + +__optional__ +|Not scheduled tasks: the date and time when the task started. +|string (date-time) + +|**stopTime** + +__optional__ +|Not scheduled tasks: the date and time when the task stopped. +|string (date-time) +|=== + +Refer to xref:n1ql:n1ql-language-reference/advisor.adoc[ADVISOR Function] for more information on index advisor sessions. + +[#sys-transactions] +== Monitor Transactions + +The `system:transactions` catalog maintains a list of active Couchbase transactions. +To see the list of active transactions, use: + +[source,sqlpp] +---- +SELECT * FROM system:transactions; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "transactions": { + "durabilityLevel": "majority", + "durabilityTimeout": "2.5s", + "expiryTime": "2021-04-21T12:53:48.598+01:00", + "id": "85aea637-2288-434b-b7c5-413ad8e7c175", + "isolationLevel": "READ COMMITED", + "lastUse": "2021-04-21T12:51:48.598+01:00", + "node": "127.0.0.1:8091", + "numAtrs": 1024, + "scanConsistency": "unbounded", + "status": 0, + "timeout": "2m0s", + "usedMemory": 960, + "uses": 1 + } + // ... + } +] +---- + +This catalog contains the following attributes: + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**durabilityLevel** + +__required__ +|Durability level for all mutations within a transaction. +|string + +|**durabilityTimeout** + +__required__ +|Durability timeout per mutation within the transaction. +|string (duration) + +|**expiryTime** + +__required__ +| +|string (date-time) + +|**id** + +__required__ +|The transaction ID. +|string + +|**isolationLevel** + +__required__ +|The isolation level of the transaction. +|string + +|**lastUse** + +__required__ +| +|string (date-time) + +|**node** + +__required__ +|The node where the transaction was started. +|string + +|**numAtrs** + +__required__ +|The total number of active transaction records. +|integer + +|**scanConsistency** + +__required__ +|The transactional scan consistency. +|string + +|**status** + +__required__ +| +|integer + +|**timeout** + +__required__ +|The transaction timeout duration. +|string (duration) + +|**usedMemory** + +__required__ +| +|integer + +|**uses** + +__required__ +| +|integer +|=== + +Refer to xref:n1ql:n1ql-language-reference/transactions.adoc[{sqlpp} Support for Couchbase Transactions] for more information. + +[#sys-sequences] +== Monitor Sequences + +The `system:sequences` catalog maintains a list of loaded sequences on any node: that is, sequences that have been accessed since the last restart. +To see the list of loaded sequences, use: + +[source,sqlpp] +---- +SELECT * FROM system:sequences; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "sequences": { + "bucket": "travel-sample", + "cache": 50, + "cycle": false, + "increment": 1, + "max": 9223372036854776000, + "min": -9223372036854776000, + "name": "seq1", + "namespace": "default", + "namespace_id": "default", + "path": "`default`:`travel-sample`.`inventory`.`seq1`", + "scope_id": "inventory", + "value": { + "73428daec3c68d8632ae66b09b70f14d": null, + "~next_block": 0 + } + } + }, +// ... +] +---- + +This catalog contains the following attributes: + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**bucket** + +__required__ +|The bucket containing the sequence. +|string + +|**cache** + +__required__ +|The sequence's cache size. +|integer + +|**cycle** + +__required__ +|Whether the sequence is set to cycle. +|boolean + +|**increment** + +__required__ +|The sequence step value. +|integer + +|**min** + +__required__ +|The minimum value permitted for the sequence. +|integer + +|**max** + +__required__ +|The maximum value permitted for the sequence. +|integer + +|**name** + +__required__ +|The name of the sequence. +|string + +|**namespace** + +__required__ +|Namespace to which the sequence belongs. +|string + +|**namespace_id** + +__required__ +|ID of the namespace to which the sequence belongs. +|string + +|**path** + +__required__ +|The fully qualified sequence name. +|string + +|**scope_id** + +__required__ +|ID of the scope to which the sequence belongs. +|string + +|**value** + +__required__ +|The current value of the sequence on each Query node. +| <> object +|=== + +[[value]] +**Values** + +[options="header", cols="~a,~a,~a"] +|=== +|Name|Description|Schema + +|**** + +__required__ +|The name of this property is the UUID of a Query node. + +The value of this property is the current value of the sequence on that node. +|Integer + +|**~next_block** + +__optional__ +|The starting vale of the next block of values that can be reserved for the sequence. +|Integer +|=== + +For further details, see xref:n1ql:n1ql-language-reference/createsequence.adoc[]. + +[#sys-all-sequences] +== Monitor All Sequences + +The `system:all_sequences` catalog maintains a list of all defined sequences. +To see the list of all defined sequences, use: + +[source,sqlpp] +---- +SELECT * FROM system:all_sequences; +---- + +This will result in a list similar to: + +[source,json] +---- +[ + { + "sequences": { + "bucket": "travel-sample", + "cache": 50, + "cycle": false, + "increment": -1, + "max": 9223372036854776000, + "min": 0, + "name": "seq4", + "namespace": "default", + "namespace_id": "default", + "path": "`default`:`travel-sample`.`inventory`.`seq4`", + "scope_id": "inventory", + "value": { + "73428daec3c68d8632ae66b09b70f14d": 10, + "~next_block": -40 + } + } + }, + { + "sequences": { + "bucket": "travel-sample", + "cache": 50, + "cycle": true, + "increment": 5, + "max": 1000, + "min": 0, + "name": "seq3", + "namespace": "default", + "namespace_id": "default", + "path": "`default`:`travel-sample`.`inventory`.`seq3`", + "scope_id": "inventory", + "value": { + "73428daec3c68d8632ae66b09b70f14d": 5, + "~next_block": 255 + } + } + }, +// ... +] +---- + +This catalog gives the same information as the <> catalog. + +For further details, see xref:n1ql:n1ql-language-reference/createsequence.adoc[]. + == Related Links * Refer to xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc[] for more information on the system namespace. \ No newline at end of file diff --git a/modules/n1ql/pages/n1ql-language-reference/alterindex.adoc b/modules/n1ql/pages/n1ql-language-reference/alterindex.adoc index 4faf1eb17..5a8e42661 100644 --- a/modules/n1ql/pages/n1ql-language-reference/alterindex.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/alterindex.adoc @@ -7,10 +7,8 @@ :console-indexes: xref:manage:manage-ui/manage-ui.adoc#console-indexes :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context :identifiers: xref:n1ql-language-reference/identifiers.adoc - -:sysinfo: xref:n1ql-intro/sysinfo.adoc -:logical-hierarchy: {sysinfo}#logical-hierarchy -:querying-indexes: {sysinfo}#querying-indexes +:logical-hierarchy: xref:n1ql:n1ql-intro/queriesandresults.adoc#logical-hierarchy +:querying-indexes: xref:n1ql-intro/sysinfo.adoc#querying-indexes [abstract] {description} diff --git a/modules/n1ql/pages/n1ql-language-reference/altersequence.adoc b/modules/n1ql/pages/n1ql-language-reference/altersequence.adoc index 094d1189f..ae2f25671 100644 --- a/modules/n1ql/pages/n1ql-language-reference/altersequence.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/altersequence.adoc @@ -8,7 +8,7 @@ :authorization-overview: xref:learn:security/authorization-overview.adoc :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context :identifiers: xref:n1ql-language-reference/identifiers.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy // TEMP include::partial$n1ql-language-reference/horizontal-style.adoc[] @@ -416,3 +416,4 @@ If you didn't do this, the sequence would cycle to the highest possible value, ` * To create a sequence, see xref:n1ql-language-reference/createsequence.adoc[]. * To drop a sequence, see xref:n1ql-language-reference/dropsequence.adoc[]. * To use a sequence in an expression, see xref:n1ql-language-reference/sequenceops.adoc[]. +* To monitor sequences, see xref:n1ql:n1ql-intro/sysinfo.adoc#sys-sequences[Monitor Sequences]. diff --git a/modules/n1ql/pages/n1ql-language-reference/build-index.adoc b/modules/n1ql/pages/n1ql-language-reference/build-index.adoc index 445e4bac2..d07cd21be 100644 --- a/modules/n1ql/pages/n1ql-language-reference/build-index.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/build-index.adoc @@ -8,7 +8,7 @@ :expression: xref:n1ql-language-reference/index.adoc :selectclause: xref:n1ql-language-reference/selectclause.adoc :subqueries: xref:n1ql-language-reference/subqueries.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :querying-indexes: xref:n1ql-intro/sysinfo.adoc#querying-indexes :keyspace-ref: xref:n1ql-language-reference/createindex.adoc#keyspace-ref diff --git a/modules/n1ql/pages/n1ql-language-reference/createcollection.adoc b/modules/n1ql/pages/n1ql-language-reference/createcollection.adoc index 90c2d8165..2b3c7a6d7 100644 --- a/modules/n1ql/pages/n1ql-language-reference/createcollection.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/createcollection.adoc @@ -5,7 +5,7 @@ :page-partial: :identifier: xref:n1ql-language-reference/identifiers.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :naming-for-scopes-and-collections: xref:learn:data/scopes-and-collections.adoc#naming-for-scopes-and-collections :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context :scopes-and-collections: xref:learn:data/scopes-and-collections.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/createfunction.adoc b/modules/n1ql/pages/n1ql-language-reference/createfunction.adoc index ab2720265..5e4556a13 100644 --- a/modules/n1ql/pages/n1ql-language-reference/createfunction.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/createfunction.adoc @@ -30,7 +30,7 @@ For more information about the restrictions and extensions that come with the Co [[context]] === Global Functions and Scoped Functions -You can create user-defined functions at two different levels of the {sqlpp} xref:n1ql-intro/sysinfo.adoc#logical-hierarchy[logical hierarchy]. +You can create user-defined functions at two different levels of the {sqlpp} xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy[logical hierarchy]. * A [def]_global function_ is created within a namespace, at the same level as the buckets within the namespace. When you call a global function, any partial keyspace references within the function definition are resolved against the function's namespace, regardless of the current xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context[query context]. @@ -659,5 +659,5 @@ At this level of precision, the geohash should appear to be in almost exactly th * To execute a user-defined function, see xref:n1ql-language-reference/execfunction.adoc[]. * To see the execution plan for a user-defined function, see xref:n1ql-language-reference/explainfunction.adoc[]. * To include a user-defined function in an expression, see xref:n1ql-language-reference/userfun.adoc[]. -* To monitor user-defined functions, see xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-functions[Monitor Functions]. +* To monitor user-defined functions, see xref:n1ql:n1ql-intro/sysinfo.adoc#sys-functions[Monitor Functions]. * To drop a user-defined function, see xref:n1ql-language-reference/dropfunction.adoc[]. diff --git a/modules/n1ql/pages/n1ql-language-reference/createindex.adoc b/modules/n1ql/pages/n1ql-language-reference/createindex.adoc index bf8c5d8a8..f3f6447a7 100644 --- a/modules/n1ql/pages/n1ql-language-reference/createindex.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/createindex.adoc @@ -17,9 +17,8 @@ Secondary indexes contain a filtered or a full set of keys in a given keyspace. :index-partitioning: xref:n1ql-language-reference/index-partitioning.adoc :indexing-meta-info: xref:n1ql-language-reference/indexing-meta-info.adoc :operator-pushdowns: xref:learn:services-and-indexes/indexes/index_pushdowns.adoc#operator-pushdowns -:sysinfo: xref:n1ql-intro/sysinfo.adoc -:logical-hierarchy: {sysinfo}#logical-hierarchy -:querying-indexes: {sysinfo}#querying-indexes +:logical-hierarchy: xref:n1ql:n1ql-intro/queriesandresults.adoc#logical-hierarchy +:querying-indexes: xref:n1ql-intro/sysinfo.adoc#querying-indexes The `CREATE INDEX` statement allows you to create a secondary index. Secondary indexes contain a filtered or a full set of keys in a given keyspace. diff --git a/modules/n1ql/pages/n1ql-language-reference/createprimaryindex.adoc b/modules/n1ql/pages/n1ql-language-reference/createprimaryindex.adoc index 9d1c582f7..d2fb9e1bd 100644 --- a/modules/n1ql/pages/n1ql-language-reference/createprimaryindex.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/createprimaryindex.adoc @@ -9,7 +9,7 @@ Primary indexes contain a full set of keys in a given keyspace. :build-index: xref:n1ql-language-reference/build-index.adoc :identifiers: xref:n1ql-language-reference/identifiers.adoc :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :querying-indexes: xref:n1ql-intro/sysinfo.adoc#querying-indexes :index-replication: xref:learn:services-and-indexes/indexes/index-replication.adoc#index-replication :query-settings: xref:manage:manage-settings/query-settings.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/createscope.adoc b/modules/n1ql/pages/n1ql-language-reference/createscope.adoc index 0a81b987a..2ed78bec8 100644 --- a/modules/n1ql/pages/n1ql-language-reference/createscope.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/createscope.adoc @@ -5,7 +5,7 @@ :page-partial: :identifier: xref:n1ql-language-reference/identifiers.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :naming-for-scopes-and-collections: xref:learn:data/scopes-and-collections.adoc#naming-for-scopes-and-collections :scopes-and-collections: xref:learn:data/scopes-and-collections.adoc :manage-scopes-and-collections: xref:manage:manage-scopes-and-collections/manage-scopes-and-collections.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/createsequence.adoc b/modules/n1ql/pages/n1ql-language-reference/createsequence.adoc index 700bfa01f..516ecd25f 100644 --- a/modules/n1ql/pages/n1ql-language-reference/createsequence.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/createsequence.adoc @@ -8,7 +8,7 @@ :authorization-overview: xref:learn:security/authorization-overview.adoc :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context :identifiers: xref:n1ql-language-reference/identifiers.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy // TEMP include::partial$n1ql-language-reference/horizontal-style.adoc[] @@ -412,3 +412,4 @@ See xref:n1ql-language-reference/sequenceops.adoc[] for detailed examples using * To alter a sequence, see xref:n1ql-language-reference/altersequence.adoc[]. * To drop a sequence, see xref:n1ql-language-reference/dropsequence.adoc[]. * To use a sequence in an expression, see xref:n1ql-language-reference/sequenceops.adoc[]. +* To monitor sequences, see xref:n1ql:n1ql-intro/sysinfo.adoc#sys-sequences[Monitor Sequences]. diff --git a/modules/n1ql/pages/n1ql-language-reference/delete.adoc b/modules/n1ql/pages/n1ql-language-reference/delete.adoc index bcf6d601f..7322a93b6 100644 --- a/modules/n1ql/pages/n1ql-language-reference/delete.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/delete.adoc @@ -4,7 +4,7 @@ :imagesdir: ../../assets/images :authorization-overview: xref:learn:security/authorization-overview.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :returning-clause: xref:n1ql-language-reference/insert.adoc#returning-clause :use-keys-clause: xref:n1ql-language-reference/hints.adoc#use-keys-clause diff --git a/modules/n1ql/pages/n1ql-language-reference/dropcollection.adoc b/modules/n1ql/pages/n1ql-language-reference/dropcollection.adoc index f8d35db89..225b32400 100644 --- a/modules/n1ql/pages/n1ql-language-reference/dropcollection.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/dropcollection.adoc @@ -5,7 +5,7 @@ :page-partial: :identifier: xref:n1ql-language-reference/identifiers.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context :scopes-and-collections: xref:learn:data/scopes-and-collections.adoc :manage-scopes-and-collections: xref:manage:manage-scopes-and-collections/manage-scopes-and-collections.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/dropfunction.adoc b/modules/n1ql/pages/n1ql-language-reference/dropfunction.adoc index b889f4263..37920655a 100644 --- a/modules/n1ql/pages/n1ql-language-reference/dropfunction.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/dropfunction.adoc @@ -156,4 +156,4 @@ http://localhost:8093/evaluator/v1/libraries/geohash-js \ * To execute a user-defined function, see xref:n1ql-language-reference/execfunction.adoc[]. * To see the execution plan for a user-defined function, see xref:n1ql-language-reference/explainfunction.adoc[]. * To include a user-defined function in an expression, see xref:n1ql-language-reference/userfun.adoc[]. -* To monitor user-defined functions, see xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-functions[Monitor Functions]. +* To monitor user-defined functions, see xref:n1ql:n1ql-intro/sysinfo.adoc#sys-functions[Monitor Functions]. diff --git a/modules/n1ql/pages/n1ql-language-reference/dropindex.adoc b/modules/n1ql/pages/n1ql-language-reference/dropindex.adoc index db218b137..53fe83e3a 100644 --- a/modules/n1ql/pages/n1ql-language-reference/dropindex.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/dropindex.adoc @@ -5,7 +5,7 @@ :authorization-overview: xref:learn:security/authorization-overview.adoc :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :identifiers: xref:n1ql-language-reference/identifiers.adoc :drop-primary-index: xref:n1ql-language-reference/dropprimaryindex.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/dropprimaryindex.adoc b/modules/n1ql/pages/n1ql-language-reference/dropprimaryindex.adoc index f08293621..c127fa8d9 100644 --- a/modules/n1ql/pages/n1ql-language-reference/dropprimaryindex.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/dropprimaryindex.adoc @@ -6,7 +6,7 @@ :roles: xref:learn:security/roles.adoc :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context :identifiers: xref:n1ql-language-reference/identifiers.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy {description} diff --git a/modules/n1ql/pages/n1ql-language-reference/dropscope.adoc b/modules/n1ql/pages/n1ql-language-reference/dropscope.adoc index 1c2683ee9..81de71a43 100644 --- a/modules/n1ql/pages/n1ql-language-reference/dropscope.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/dropscope.adoc @@ -5,7 +5,7 @@ :page-partial: :identifier: xref:n1ql-language-reference/identifiers.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :scopes-and-collections: xref:learn:data/scopes-and-collections.adoc :manage-scopes-and-collections: xref:manage:manage-scopes-and-collections/manage-scopes-and-collections.adoc :scopes-and-collections-api: xref:rest-api:scopes-and-collections-api.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/dropsequence.adoc b/modules/n1ql/pages/n1ql-language-reference/dropsequence.adoc index b1a42fdf7..b11eb69a8 100644 --- a/modules/n1ql/pages/n1ql-language-reference/dropsequence.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/dropsequence.adoc @@ -8,7 +8,7 @@ :authorization-overview: xref:learn:security/authorization-overview.adoc :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context :identifiers: xref:n1ql-language-reference/identifiers.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy // TEMP include::partial$n1ql-language-reference/horizontal-style.adoc[] @@ -119,4 +119,5 @@ DROP SEQUENCE seq2 IF EXISTS; * To create a sequence, see xref:n1ql-language-reference/createsequence.adoc[]. * To alter a sequence, see xref:n1ql-language-reference/altersequence.adoc[]. -* To use a sequence in an expression, see xref:n1ql-language-reference/sequenceops.adoc[]. \ No newline at end of file +* To use a sequence in an expression, see xref:n1ql-language-reference/sequenceops.adoc[]. +* To monitor sequences, see xref:n1ql:n1ql-intro/sysinfo.adoc#sys-sequences[Monitor Sequences]. diff --git a/modules/n1ql/pages/n1ql-language-reference/execfunction.adoc b/modules/n1ql/pages/n1ql-language-reference/execfunction.adoc index 44b6d99de..e34fa0adf 100644 --- a/modules/n1ql/pages/n1ql-language-reference/execfunction.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/execfunction.adoc @@ -97,5 +97,5 @@ For examples, refer to xref:n1ql-language-reference/createfunction.adoc#examples * To manage external libraries and external functions, see xref:n1ql-rest-api/functions.adoc[]. * To see the execution plan for a user-defined function, see xref:n1ql-language-reference/explainfunction.adoc[]. * To include a user-defined function in an expression, see xref:n1ql-language-reference/userfun.adoc[]. -* To monitor user-defined functions, see xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-functions[Monitor Functions]. +* To monitor user-defined functions, see xref:n1ql:n1ql-intro/sysinfo.adoc#sys-functions[Monitor Functions]. * To drop a user-defined function, see xref:n1ql-language-reference/dropfunction.adoc[]. diff --git a/modules/n1ql/pages/n1ql-language-reference/explainfunction.adoc b/modules/n1ql/pages/n1ql-language-reference/explainfunction.adoc index 7c9583a22..1862a08dd 100644 --- a/modules/n1ql/pages/n1ql-language-reference/explainfunction.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/explainfunction.adoc @@ -141,5 +141,5 @@ include::n1ql:example$utility/explainfunctionjs.jsonc[] * To manage external libraries and external functions, see xref:n1ql-rest-api/functions.adoc[]. * To execute a user-defined function, see xref:n1ql-language-reference/execfunction.adoc[]. * To include a user-defined function in an expression, see xref:n1ql-language-reference/userfun.adoc[]. -* To monitor user-defined functions, see xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-functions[Monitor Functions]. +* To monitor user-defined functions, see xref:n1ql:n1ql-intro/sysinfo.adoc#sys-functions[Monitor Functions]. * To drop a user-defined function, see xref:n1ql-language-reference/dropfunction.adoc[]. diff --git a/modules/n1ql/pages/n1ql-language-reference/from.adoc b/modules/n1ql/pages/n1ql-language-reference/from.adoc index d332313c2..c3b90518a 100644 --- a/modules/n1ql/pages/n1ql-language-reference/from.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/from.adoc @@ -5,7 +5,7 @@ :authorization-overview: xref:learn:security/authorization-overview.adoc :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :selectclause: xref:n1ql-language-reference/selectclause.adoc :join: xref:n1ql-language-reference/join.adoc :nest: xref:n1ql-language-reference/nest.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/grant.adoc b/modules/n1ql/pages/n1ql-language-reference/grant.adoc index 1dc9b2170..7c643ee57 100644 --- a/modules/n1ql/pages/n1ql-language-reference/grant.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/grant.adoc @@ -4,7 +4,7 @@ :imagesdir: ../../assets/images :authorization-overview: xref:learn:security/authorization-overview.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :keyspace-ref: xref:n1ql-language-reference/createindex.adoc#keyspace-ref [abstract] diff --git a/modules/n1ql/pages/n1ql-language-reference/infer.adoc b/modules/n1ql/pages/n1ql-language-reference/infer.adoc index acb48de3f..34f5c7193 100644 --- a/modules/n1ql/pages/n1ql-language-reference/infer.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/infer.adoc @@ -4,7 +4,7 @@ :page-topic-type: reference :authorization-overview: xref:learn:security/authorization-overview.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :keyspace-ref: xref:n1ql-language-reference/createindex.adoc#keyspace-ref :bucket-analyzer: xref:tools:query-workbench.adoc#bucket-analyzer diff --git a/modules/n1ql/pages/n1ql-language-reference/insert.adoc b/modules/n1ql/pages/n1ql-language-reference/insert.adoc index 15720c751..fa2df61e7 100644 --- a/modules/n1ql/pages/n1ql-language-reference/insert.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/insert.adoc @@ -7,7 +7,7 @@ :bucket-expiration: xref:learn:data/expiration.adoc :roles: xref:learn:security/roles.adoc :install-sample-buckets: xref:manage:manage-settings/install-sample-buckets.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :paths: xref:n1ql-intro/queriesandresults.adoc#paths :explain: xref:n1ql-language-reference/explain.adoc :upsert: xref:n1ql-language-reference/upsert.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/merge.adoc b/modules/n1ql/pages/n1ql-language-reference/merge.adoc index 0a30a5523..72885b9af 100644 --- a/modules/n1ql/pages/n1ql-language-reference/merge.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/merge.adoc @@ -6,7 +6,7 @@ :authorization-overview: xref:learn:security/authorization-overview.adoc :bucket-expiration: xref:learn:data/expiration.adoc :preserve_expiry: xref:n1ql:n1ql-manage/query-settings.adoc#preserve_expiry -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :selectclause: xref:n1ql-language-reference/selectclause.adoc :subqueries: xref:n1ql-language-reference/subqueries.adoc :expression: xref:n1ql-language-reference/index.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/revoke.adoc b/modules/n1ql/pages/n1ql-language-reference/revoke.adoc index d7a2e728d..2f72cdcbc 100644 --- a/modules/n1ql/pages/n1ql-language-reference/revoke.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/revoke.adoc @@ -4,7 +4,7 @@ :imagesdir: ../../assets/images :authorization-overview: xref:learn:security/authorization-overview.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :keyspace-ref: xref:n1ql-language-reference/createindex.adoc#keyspace-ref [abstract] diff --git a/modules/n1ql/pages/n1ql-language-reference/sequenceops.adoc b/modules/n1ql/pages/n1ql-language-reference/sequenceops.adoc index b856e5fb3..fe8ae6de1 100644 --- a/modules/n1ql/pages/n1ql-language-reference/sequenceops.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/sequenceops.adoc @@ -9,7 +9,7 @@ :authorization-overview: xref:learn:security/authorization-overview.adoc :query-context: xref:n1ql:n1ql-intro/queriesandresults.adoc#query-context :identifiers: xref:n1ql-language-reference/identifiers.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy // TEMP include::partial$n1ql-language-reference/horizontal-style.adoc[] @@ -397,4 +397,5 @@ GROUP BY o.num, o.user; * To create a sequence, see xref:n1ql-language-reference/createsequence.adoc[]. * To alter a sequence, see xref:n1ql-language-reference/altersequence.adoc[]. -* To drop a sequence, see xref:n1ql-language-reference/dropsequence.adoc[]. \ No newline at end of file +* To drop a sequence, see xref:n1ql-language-reference/dropsequence.adoc[]. +* To monitor sequences, see xref:n1ql:n1ql-intro/sysinfo.adoc#sys-sequences[Monitor Sequences]. diff --git a/modules/n1ql/pages/n1ql-language-reference/statistics-delete.adoc b/modules/n1ql/pages/n1ql-language-reference/statistics-delete.adoc index 94219e9ce..7c04179c3 100644 --- a/modules/n1ql/pages/n1ql-language-reference/statistics-delete.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/statistics-delete.adoc @@ -11,7 +11,7 @@ :array-expr: {n1ql}/indexing-arrays.adoc#array-expr :meta-info-expr: {n1ql}/indexing-meta-info.adoc#metakeyspace_expr-property :keyspace-ref: {n1ql}/createindex.adoc#keyspace-ref -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy //Related links :updatestatistics: {n1ql}/updatestatistics.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/statistics-expressions.adoc b/modules/n1ql/pages/n1ql-language-reference/statistics-expressions.adoc index 5aef97cd9..9449dff02 100644 --- a/modules/n1ql/pages/n1ql-language-reference/statistics-expressions.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/statistics-expressions.adoc @@ -14,7 +14,7 @@ :adaptive-expr: {n1ql}/adaptive-indexing.adoc#index-key :meta-info-expr: {n1ql}/indexing-meta-info.adoc#metakeyspace_expr-property :distribution-stats: {cbo}#distribution-stats -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy //Related links :updatestatistics: {n1ql}/updatestatistics.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/statistics-index.adoc b/modules/n1ql/pages/n1ql-language-reference/statistics-index.adoc index 3141a4097..aaa4cb8f5 100644 --- a/modules/n1ql/pages/n1ql-language-reference/statistics-index.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/statistics-index.adoc @@ -12,7 +12,7 @@ :index-path-alter: {n1ql}/alterindex.adoc#index-path :index-path-drop: {n1ql}/dropindex.adoc#index-path :distribution-stats: {cbo}#distribution-stats -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy //Related links :updatestatistics: {n1ql}/updatestatistics.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/statistics-indexes.adoc b/modules/n1ql/pages/n1ql-language-reference/statistics-indexes.adoc index 5b43ce8a4..830257a9d 100644 --- a/modules/n1ql/pages/n1ql-language-reference/statistics-indexes.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/statistics-indexes.adoc @@ -10,7 +10,7 @@ :selectclause: {n1ql}/selectclause.adoc :keyspace-ref: {n1ql}/createindex.adoc#keyspace-ref :distribution-stats: {cbo}#distribution-stats -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy //Related links :updatestatistics: {n1ql}/updatestatistics.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/transactions.adoc b/modules/n1ql/pages/n1ql-language-reference/transactions.adoc index 841d458d6..ce0ffbc4d 100644 --- a/modules/n1ql/pages/n1ql-language-reference/transactions.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/transactions.adoc @@ -22,7 +22,7 @@ // Manage cross-references :install-sample-buckets: xref:manage:manage-settings/install-sample-buckets.adoc -:sys-transactions: xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-transactions +:sys-transactions: xref:n1ql:n1ql-intro/sysinfo.adoc#sys-transactions // Tools cross-references :query-workbench: xref:tools:query-workbench.adoc diff --git a/modules/n1ql/pages/n1ql-language-reference/update.adoc b/modules/n1ql/pages/n1ql-language-reference/update.adoc index 4a86d6540..4c091d361 100644 --- a/modules/n1ql/pages/n1ql-language-reference/update.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/update.adoc @@ -5,7 +5,7 @@ :authorization-overview: xref:learn:security/authorization-overview.adoc :bucket-expiration: xref:learn:data/expiration.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :document-expiration: xref:java-sdk:howtos:kv-operations.adoc#document-expiration :meta: xref:n1ql-language-reference/metafun.adoc#meta :returning-clause: xref:n1ql-language-reference/insert.adoc#returning-clause diff --git a/modules/n1ql/pages/n1ql-language-reference/upsert.adoc b/modules/n1ql/pages/n1ql-language-reference/upsert.adoc index 2333b03dc..9cc2c18bc 100644 --- a/modules/n1ql/pages/n1ql-language-reference/upsert.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/upsert.adoc @@ -6,7 +6,7 @@ :authorization-overview: xref:learn:security/authorization-overview.adoc :bucket-expiration: xref:learn:data/expiration.adoc :select-syntax: xref:n1ql-language-reference/select-syntax.adoc -:logical-hierarchy: xref:n1ql-intro/sysinfo.adoc#logical-hierarchy +:logical-hierarchy: xref:n1ql-intro/queriesandresults.adoc#logical-hierarchy :paths: xref:n1ql-intro/queriesandresults.adoc#paths :document-expiration: xref:java-sdk:howtos:kv-operations.adoc#document-expiration :preserve_expiry: xref:n1ql:n1ql-manage/query-settings.adoc#preserve_expiry diff --git a/modules/n1ql/pages/n1ql-language-reference/userfun.adoc b/modules/n1ql/pages/n1ql-language-reference/userfun.adoc index d1c969441..ca2b847e9 100644 --- a/modules/n1ql/pages/n1ql-language-reference/userfun.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/userfun.adoc @@ -191,5 +191,5 @@ At the latitude of the selected hotel, each geohash represents an area of approx * To manage external libraries and external functions, see xref:n1ql-rest-api/functions.adoc[]. * To execute a user-defined function, see xref:n1ql-language-reference/execfunction.adoc[]. * To see the execution plan for a user-defined function, see xref:n1ql-language-reference/explainfunction.adoc[]. -* To monitor user-defined functions, see xref:n1ql:n1ql-manage/monitoring-n1ql-query.adoc#sys-functions[Monitor Functions]. +* To monitor user-defined functions, see xref:n1ql:n1ql-intro/sysinfo.adoc#sys-functions[Monitor Functions]. * To drop a user-defined function, see xref:n1ql-language-reference/dropfunction.adoc[]. diff --git a/modules/n1ql/pages/n1ql-manage/index.adoc b/modules/n1ql/pages/n1ql-manage/index.adoc index d1ba08781..b1cd9b63a 100644 --- a/modules/n1ql/pages/n1ql-manage/index.adoc +++ b/modules/n1ql/pages/n1ql-manage/index.adoc @@ -20,8 +20,8 @@ include::ROOT:partial$component-signpost.adoc[] == Get System Information -{sqlpp} has a system namespace that stores metadata about data containers. -You can query the system namespace to get information about the data containers. +{sqlpp} has a system namespace that stores metadata about data containers, the Query service, and the system as a whole. +You can query the system namespace to get this information. * xref:n1ql:n1ql-intro/sysinfo.adoc[] diff --git a/modules/n1ql/pages/n1ql-manage/monitoring-n1ql-query.adoc b/modules/n1ql/pages/n1ql-manage/monitoring-n1ql-query.adoc index 92df234cd..d9f0dd082 100644 --- a/modules/n1ql/pages/n1ql-manage/monitoring-n1ql-query.adoc +++ b/modules/n1ql/pages/n1ql-manage/monitoring-n1ql-query.adoc @@ -9,8 +9,8 @@ In fact, often it is vital for diagnosing and troubleshooting issues such as que include::ROOT:partial$component-signpost.adoc[] -System keyspaces provide various monitoring details and statistics about individual queries and query service. -When running on a cluster with multiple query nodes, stats about all queries on all query nodes are collected in these system keyspaces. +System keyspaces provide various monitoring details and statistics about individual queries and the Query service. +When running on a cluster with multiple query nodes, stats about all queries on all query nodes are collected in the Query management and monitoring system keyspaces. For example, this can help identify: @@ -19,75 +19,22 @@ For example, this can help identify: * Details about the active, completed, and prepared queries. * Find long running queries that are running for more than 2 minutes. -These system keyspaces are like virtual keyspaces that are transient in nature, and are not persisted to disk or permanent storage. -Hence, the information in the keyspaces pertains to the current instantiation of the query service. +These system keyspaces are transient in nature, and are not persisted to disk or permanent storage. +Hence, the information in the keyspaces pertains to the current instantiation of the Query service. -//// -TODO: Reinstate this for monitoring and managing when other content is moved to the System Information page -You can access the keyspaces using any of the following: +You can access the Query management and monitoring system keyspaces using any of the following: -* {sqlpp} language (from the cbq shell or Query Workbench) -* REST API -* Monitoring SDK -//// +* {sqlpp} from the cbq shell or Query Workbench +* The Query Admin REST API +* A monitoring SDK -NOTE: All the power of the {sqlpp} query language can be applied on the keyspaces to obtain various insights. - -The following diagnostics are provided: - -[cols="1,3"] -|=== -| System Catalogs -a| [%hardbreaks] -xref:n1ql:n1ql-intro/sysinfo.adoc#querying-datastores[system:datastores] -xref:n1ql:n1ql-intro/sysinfo.adoc#querying-namespaces[system:namespaces] -xref:n1ql:n1ql-intro/sysinfo.adoc#querying-buckets[system:buckets] -xref:n1ql:n1ql-intro/sysinfo.adoc#querying-scopes[system:scopes] -xref:n1ql:n1ql-intro/sysinfo.adoc#querying-keyspaces[system:keyspaces] -xref:n1ql:n1ql-intro/sysinfo.adoc#querying-indexes[system:indexes] -xref:n1ql:n1ql-intro/sysinfo.adoc#querying-dual[system:dual] - -| Monitoring Catalogs -a| [%hardbreaks] -<> -<> -<> -<> - -| Security Catalogs -a| [%hardbreaks] -<> -<> -<> -<> - -| Other -a| [%hardbreaks] -<> -<> -<> -<> -<> -<> -<> -<> -|=== +Using {sqlpp} enables you to obtain further insights from the keyspaces. == Authentication and Client Privileges -Client applications must be authenticated with sufficient privileges to access system keyspaces. - -* Users must have the *Query System Catalog* role to access restricted system keyspaces. +Users must have the *Query System Catalog* role to access restricted system keyspaces. For more details about user roles, see xref:learn:security/authorization-overview.adoc[Authorization]. -* In addition, users must have permission to access a bucket, scope, or collection to be able to view that item in the system catalog. -Similarly, users must have SELECT permission on the target of an index to be able to view that index in the system catalog. - -* The following system keyspaces are considered open, that is, all users can access them without any special privileges: - ** `system:dual` - ** `system:datastores` - ** `system:namespaces` - == Examples on this Page In the REST API examples: @@ -99,7 +46,7 @@ In the REST API examples: [#vitals] == Monitor System Vitals -The `system:vitals` catalog provides data about the running state and health of the query node, such as number of logical cores, active threads, queued threads, CPU utilization, memory usage, network utilization, garbage collection percentage, and so on. +The `system:vitals` catalog provides data about the running state and health of the query nodes, such as number of logical cores, active threads, queued threads, CPU utilization, memory usage, network utilization, garbage collection percentage, and so on. This information can be very useful to assess the current workload and performance characteristics of a query node. [#sys-vitals-get] @@ -1412,1192 +1359,61 @@ Getting the plan for a statement that you ran when the profile was set to `timin For field names and meanings, see xref:n1ql:n1ql-rest-api/index.adoc#_execution_timings[Execution Timings]. -[#sys_my-user-info] -== Monitor Your User Info - -The `system:my_user_info` catalog maintains a list of all information of your profile. - -To see your current information, use: - -[source,sqlpp] ----- -SELECT * FROM system:my_user_info; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "my_user_info": { - "domain": "local", - "external_groups": [], - "groups": [], - "id": "jane", - "name": "Jane Doe", - "password_change_date": "2019-05-07T02:31:53.000Z", - "roles": [ - { - "origins": [ - { - "type": "user" - } - ], - "role": "admin" - } - ] - } - } -] ----- - -[#sys-user-info] -== Monitor All User Info - -The `system:user_info` catalog maintains a list of all current users in your bucket and their information. - -To see the list of all current users, use: - -[source,sqlpp] ----- -SELECT * FROM system:user_info; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "user_info": { - "domain": "local", - "external_groups": [], - "groups": [], - "id": "jane", - "name": "Jane Doe", - "password_change_date": "2019-05-07T02:31:53.000Z", - "roles": [ - { - "origins": [ - { - "type": "user" - } - ], - "role": "admin" - } - ] - } - }, - { - "user_info": { - "domain": "ns_server", - "id": "Administrator", - "name": "Administrator", - "roles": [ - { - "role": "admin" - } - ] - } - } -] ----- - -[#sys-nodes] -== Monitor Nodes - -The `system:nodes` catalog shows the datastore topology information. -This is separate from the Query clustering view, in that Query clustering shows a map of the Query cluster, as provided by the cluster manager, while `system:nodes` shows a view of the nodes and services that make up the actual datastore, which may or may not include Query nodes. - -* The dichotomy is important in that Query nodes could be clustered by one entity (e.g. Zookeeper) and be connected to a clustered datastore (e.g. Couchbase) such that each does not have visibility of the other. -* Should {sqlpp} be extended to be able to concurrently connect to multiple datastores, each datastore will report its own topology, so that `system:nodes` offers a complete view of all the storage nodes, whatever those may be. -* The `system:nodes` keyspace provides a way to report services advertised by each node as well as services that are actually running. -This is datastore dependent. -* Query clustering is still reported by the `/admin` endpoints. - -To see the list of all current node information, use: - -[source,sqlpp] ----- -SELECT * FROM system:nodes; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "nodes": { - "name": "127.0.0.1:8091", - "ports": { - "cbas": 8095, - "cbasAdmin": 9110, - "cbasCc": 9111, - "cbasSSL": 18095, - "eventingAdminPort": 8096, - "eventingSSL": 18096, - "fts": 8094, - "ftsSSL": 18094, - "indexAdmin": 9100, - "indexHttp": 9102, - "indexHttps": 19102, - "indexScan": 9101, - "indexStreamCatchup": 9104, - "indexStreamInit": 9103, - "indexStreamMaint": 9105, - "kv": 11210, - "kvSSL": 11207, - "n1ql": 8093, - "n1qlSSL": 18093 - }, - "services": [ - "cbas", - "eventing", - "fts", - "index", - "kv", - "n1ql" - ] - } - } -] ----- - -[#sys-app-roles] -== Monitor Applicable Roles - -The `system:applicable_roles` catalog maintains a list of all applicable roles and grantee of each bucket. - -To see the list of all current applicable role information, use: - -[source,sqlpp] ----- -SELECT * FROM system:applicable_roles; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "applicable_roles": { - "grantee": "anil", - "role": "replication_admin" - } - }, - { - "applicable_roles": { - "bucket_name": "travel-sample", - "grantee": "anil", - "role": "select" - } - }, - { - "applicable_roles": { - "bucket_name": "*", - "grantee": "anil", - "role": "select" - } - } -] ----- - -For more examples, take a look at the blog: https://blog.couchbase.com/optimize-n1ql-performance-using-request-profiling/[Optimize {sqlpp} performance using request profiling^]. - -[#sys-dictionary] -== Monitor Statistics +== Query Profiling Summary -The `system:dictionary` catalog maintains a list of the on-disk optimizer statistics stored in the `_query` collection within the `_system` scope. +The following table summarizes Query profiling behavior. -If you have multiple query nodes, the data retrieved from this catalog will be the same, regardless of the node on which you run the query. - -To see the list of on-disk optimizer statistics, use: - -[source,sqlpp] ----- -SELECT * FROM system:dictionary; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "dictionary": { - "avgDocKeySize": 12, - "avgDocSize": 278, - "bucket": "travel-sample", - "distributionKeys": [ - "airportname", - "faa", - "city" - ], - "docCount": 1968, - "indexes": [ - { - "indexId": "bc3048e87bf84828", - "indexName": "def_inventory_airport_primary", - "indexStats": [ - { - "avgItemSize": 24, - "avgPageSize": 11760, - "numItems": 1968, - "numPages": 4, - "resRatio": 1 - } - ] - }, - // ... - ], - "keyspace": "airport", - "namespace": "default", - "scope": "inventory" - } - }, - // ... -] ----- - -This catalog contains an array of dictionaries, one for each keyspace for which optimizer statistics are available. -Each dictionary gives the following information: - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**avgDocKeySize** + -__required__ -|Average doc key size. -|Integer - -|**avgDocSize** + -__required__ -|Average doc size. -|Integer - -|**bucket** + -__required__ -|The bucket for which statistics are available. -|String - -|**keyspace** + -__required__ -|The keyspace for which statistics are available. -|String - -|**namespace** + -__required__ -|The namespace for which statistics are available. -|String - -|**scope** + -__required__ -|The scope for which statistics are available. -|String - -|**distributionKeys** + -__required__ -|Distribution keys for which histograms are available. -|String array - -|**docCount** + -__required__ -|Document count. -|Integer - -|**indexes** + -__required__ -|An array of indexes in this keyspace for which statistics are available. -|<> array - -|**node** + -__required__ -|The query node where this dictionary cache is resident. -|String -|=== - -[[indexes]] -**Indexes** - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**indexId** + -__required__ -|The index ID. -|String - -|**indexName** + -__required__ -|The index name. -|String - -|**indexStats** + -__required__ -|An array of statistics for each index, with one element for each index partition. -|<> array +[%header,cols=7*] |=== - -[[indexStats]] -**Index Statistics** - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**avgItemSize** + -__required__ -|Average item size. -|Integer - -|**avgPageSize** + -__required__ -|Average page size. -|Integer - -|**numItems** + -__required__ -|Number of items. -|Integer - -|**numPages** + -__required__ -|Number of pages. -|Integer - -|**resRatio** + -__required__ -|Resident ratio. -|Integer -|=== - -For further details, see xref:n1ql:n1ql-language-reference/updatestatistics.adoc[]. - -[#sys-dictionary-cache] -== Monitor Cached Statistics - -The `system:dictionary_cache` catalog maintains a list of the in-memory cached subset of the optimizer statistics. - -If you have multiple query nodes, the data retrieved from this node shows cached optimizer statistics from all nodes. -Individual nodes may have a different subset of cached information. - -To see the list of in-memory optimizer statistics, use: - -[source,sqlpp] ----- -SELECT * FROM system:dictionary_cache; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "dictionary_cache": { - "avgDocKeySize": 12, - "avgDocSize": 278, - "bucket": "travel-sample", - "distributionKeys": [ - "airportname", - "faa", - "city" - ], - "docCount": 1968, - "indexes": [ - { - "indexId": "bc3048e87bf84828", - "indexName": "def_inventory_airport_primary", - "indexStats": [ - { - "avgItemSize": 24, - "avgPageSize": 11760, - "numItems": 1968, - "numPages": 4, - "resRatio": 1 - } - ] - }, - // ... - ], - "keyspace": "airport", - "namespace": "default", - "node": "172.23.0.3:8091", - "scope": "inventory" - } - }, - // ... -] ----- - -This catalog contains an array of dictionary caches, one for each keyspace for which optimizer statistics are available. -Each dictionary cache gives the same information as the <> catalog. - -For further details, see xref:n1ql:n1ql-language-reference/updatestatistics.adoc[]. - -[#sys-functions] -== Monitor Functions - -The `system:functions` catalog maintains a list of all user-defined functions across all nodes. -To see the list of all user-defined functions, use: - -[source,sqlpp] ----- -SELECT * FROM system:functions; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "functions": { - "definition": { - "#language": "inline", - "expression": "(((`fahrenheit` - 32) * 5) / 9)", - "parameters": [ - "fahrenheit" - ], - "text": "((fahrenheit - 32) * 5/9)" - }, - "identity": { - "bucket": "travel-sample", - "name": "celsius", - "namespace": "default", - "scope": "inventory", - "type": "scope" - } - } - }, - { - "functions": { - "definition": { - "#language": "javascript", - "library": "geohash-js", - "name": "geohash-js", - "object": "calculateAdjacent", - "parameters": [ - "src", - "dir" - ] - }, - "identity": { - "name": "adjacent", - "namespace": "default", - "type": "global" - } - } - }, - // ... -] ----- - -This catalog contains the following attributes: - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**definition** + -__required__ -|The definition of the function. -|<> object - -|**identity** + -__required__ -|The identity of the function. -|<> object -|=== - -[[definition]] -**Definition** - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**#language** + -__required__ -|The language of the function. - -*Example*: `inline` -|String - -|**parameters** + -__required__ -|The parameters required by the function. -|String array - -|**expression** + -__optional__ -|For inline functions only: the expression defining the function. -|String - -|**text** + -__optional__ -|For inline functions: the verbatim text of the function. - -''' - -For {sqlpp} managed user-defined functions: the external code defining the function. -|String - -|**library** + -__optional__ -|For external functions only: the library containing the function. -|String - -|**name** + -__optional__ -|For external functions only: the relative name of the library. -|String - -|**object** + -__optional__ -|For external functions only: the object defining the function. -|String -|=== - -[[identity]] -**Identity** - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**name** + -__required__ -|The name of the function. -|String - -|**namespace** + -__required__ -|The namespace of the function. - -*Example*: `default` -|String - -|**type** + -__required__ -|The type of the function. - -*Example*: `global` -|String - -|**bucket** + -__optional__ -|For scoped functions only: the bucket containing the function. -|String - -|**scope** + -__optional__ -|For scoped functions only: the scope containing the function. -|String -|=== - -[#sys-functions-cache] -== Monitor Cached Functions - -The `system:functions_cache` catalog maintains a list of recently-used user-defined functions across all nodes. -The catalog also lists user-defined functions that have been called recently, but do not exist. -To see the list of recently-used user-defined functions, use: - -[source,sqlpp] ----- -SELECT * FROM system:functions_cache; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "functions_cache": { - "#language": "inline", - "avgServiceTime": "3.066847ms", - "expression": "(((`fahrenheit` - 32) * 5) / 9)", - "lastUse": "2022-03-09 00:17:59.60659793 +0000 UTC m=+35951.429537902", - "maxServiceTime": "3.066847ms", - "minServiceTime": "0s", - "name": "celsius", - "namespace": "default", - "node": "127.0.0.1:8091", - "parameters": [ - "fahrenheit" - ], - "scope": "inventory", - "text": "((fahrenheit - 32) * 5/9)", - "type": "scope", - "uses": 1 - } - }, - { - "functions_cache": { - "#language": "javascript", - "avgServiceTime": "56.892636ms", - "lastUse": "2022-03-09 00:15:46.289934029 +0000 UTC m=+35818.007560703", - "library": "geohash-js", - "maxServiceTime": "146.025426ms", - "minServiceTime": "0s", - "name": "geohash-js", - "namespace": "default", - "node": "127.0.0.1:8091", - "object": "calculateAdjacent", - "parameters": [ - "src", - "dir" - ], - "type": "global", - "uses": 4 - } - }, - { - "functions_cache": { - "avgServiceTime": "3.057421ms", - "lastUse": "2022-03-09 00:17:25.396840275 +0000 UTC m=+35917.199008929", - "maxServiceTime": "3.057421ms", - "minServiceTime": "0s", - "name": "notFound", - "namespace": "default", - "node": "127.0.0.1:8091", - "type": "global", - "undefined_function": true, - "uses": 1 - } - } -] ----- - -This catalog contains the following attributes: - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**#language** + -__required__ -|The language of the function. - -*Example*: `inline` -|String - -|**name** + -__required__ -|The name of the function. -|String - -|**namespace** + -__required__ -|The namespace of the function. - -*Example*: `default` -|String - -|**parameters** + -__required__ -|The parameters required by the function. -|String array - -|**type** + -__required__ -|The type of the function. - -*Example*: `global` -|String - -|**scope** + -__optional__ -|For scoped functions only: the scope containing the function. -|String - -|**expression** + -__optional__ -|For inline functions only: the expression defining the function. -|String - -|**text** + -__optional__ -|For inline functions: the verbatim text of the function. - -''' - -For {sqlpp} managed user-defined functions: the external code defining the function. -|String - -|**library** + -__optional__ -|For external functions only: the library containing the function. -|String - -|**object** + -__optional__ -|For external functions only: the object defining the function. -|String - -|**avgServiceTime** + -__required__ -|The mean service time for the function. -|String - -|**lastUse** + -__required__ -|The date and time when the function was last used. -|String - -|**maxServiceTime** + -__required__ -|The maximum service time for the function. -|String - -|**minServiceTime** + -__required__ -|The minimum service time for the function. -|String - -|**node** + -__required__ -|The query node where the function is cached. -|String - -|**undefined_function** + -__required__ -|Whether the function exists or is undefined. -|Boolean - -|**uses** + -__required__ -|The number of uses of the function. -|Number -|=== - -Each query node keeps its own cache of recently-used user-defined functions, so you may see the same function listed for multiple nodes. - -[#sys-tasks-cache] -== Monitor Cached Tasks - -The `system:tasks_cache` catalog maintains a list of recently-used scheduled tasks, such as index advisor sessions. -To see the list of recently-used scheduled tasks, use: - -[source,sqlpp] ----- -SELECT * FROM system:tasks_cache; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "tasks_cache": { - "class": "advisor", - "delay": "1h0m0s", - "id": "bcd9f8e4-b324-504c-a98b-ace90dba869f", - "name": "aa7f688a-bf29-438f-888f-eeaead87ca40", - "node": "10.143.192.101:8091", - "state": "scheduled", - "subClass": "analyze", - "submitTime": "2019-09-17 05:18:12.903122381 -0700 PDT m=+8460.550715992" - } - }, - { - "tasks_cache": { - "class": "advisor", - "delay": "5m0s", - "id": "254abec5-5782-543e-9ee0-d07da146b94e", - "name": "ca2cfe56-01fa-4563-8eb0-a753af76d865", - "node": "10.143.192.101:8091", - "results": [ - // ... - ], - "startTime": "2019-09-17 05:03:31.821597725 -0700 PDT m=+7579.469191487", - "state": "completed", - "stopTime": "2019-09-17 05:03:31.963133954 -0700 PDT m=+7579.610727539", - "subClass": "analyze", - "submitTime": "2019-09-17 04:58:31.821230131 -0700 PDT m=+7279.468823737" - } - } -] ----- - -This catalog contains the following attributes: - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**class** + -__required__ -|The class of the task. - -*Example*: ``advisor`` -|string - -|**delay** + -__required__ -|The scheduled duration of the task. -|string - -|**id** + -__required__ -|The internal ID of the task. -|string - -|**name** + -__required__ -|The name of the task. -|string - -|**node** + -__required__ -|The node where the task was started. -|string - -|**state** + -__required__ -|The state of the task. - -*Values*: `scheduled`, `cancelled`, `completed` -|string - -|**subClass** + -__required__ -|The subclass of the task. - -*Example*: `analyze` -|string - -|**submitTime** + -__required__ -|The date and time when the task was submitted. -|string - -|**results** + -__optional__ -|Not scheduled tasks: the results of the task. -|Any array - -|**startTime** + -__optional__ -|Not scheduled tasks: the date and time when the task started. -|string (date-time) - -|**stopTime** + -__optional__ -|Not scheduled tasks: the date and time when the task stopped. -|string (date-time) -|=== - -Refer to xref:n1ql:n1ql-language-reference/advisor.adoc[ADVISOR Function] for more information on index advisor sessions. - -[#sys-transactions] -== Monitor Transactions - -The `system:transactions` catalog maintains a list of active Couchbase transactions. -To see the list of active transactions, use: - -[source,sqlpp] ----- -SELECT * FROM system:transactions; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "transactions": { - "durabilityLevel": "majority", - "durabilityTimeout": "2.5s", - "expiryTime": "2021-04-21T12:53:48.598+01:00", - "id": "85aea637-2288-434b-b7c5-413ad8e7c175", - "isolationLevel": "READ COMMITED", - "lastUse": "2021-04-21T12:51:48.598+01:00", - "node": "127.0.0.1:8091", - "numAtrs": 1024, - "scanConsistency": "unbounded", - "status": 0, - "timeout": "2m0s", - "usedMemory": 960, - "uses": 1 - } - // ... - } -] ----- - -This catalog contains the following attributes: - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**durabilityLevel** + -__required__ -|Durability level for all mutations within a transaction. -|string - -|**durabilityTimeout** + -__required__ -|Durability timeout per mutation within the transaction. -|string (duration) - -|**expiryTime** + -__required__ -| -|string (date-time) - -|**id** + -__required__ -|The transaction ID. -|string - -|**isolationLevel** + -__required__ -|The isolation level of the transaction. -|string - -|**lastUse** + -__required__ -| -|string (date-time) - -|**node** + -__required__ -|The node where the transaction was started. -|string - -|**numAtrs** + -__required__ -|The total number of active transaction records. -|integer - -|**scanConsistency** + -__required__ -|The transactional scan consistency. -|string - -|**status** + -__required__ -| -|integer - -|**timeout** + -__required__ -|The transaction timeout duration. -|string (duration) - -|**usedMemory** + -__required__ -| -|integer - -|**uses** + -__required__ -| -|integer -|=== - -Refer to xref:n1ql:n1ql-language-reference/transactions.adoc[{sqlpp} Support for Couchbase Transactions] for more information. - -[#sys-sequences] -== Monitor Sequences - -The `system:sequences` catalog maintains a list of loaded sequences on any node: that is, sequences that have been accessed since the last restart. -To see the list of loaded sequences, use: - -[source,sqlpp] ----- -SELECT * FROM system:sequences; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "sequences": { - "bucket": "travel-sample", - "cache": 50, - "cycle": false, - "increment": 1, - "max": 9223372036854776000, - "min": -9223372036854776000, - "name": "seq1", - "namespace": "default", - "namespace_id": "default", - "path": "`default`:`travel-sample`.`inventory`.`seq1`", - "scope_id": "inventory", - "value": { - "73428daec3c68d8632ae66b09b70f14d": null, - "~next_block": 0 - } - } - }, -// ... -] ----- - -This catalog contains the following attributes: - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**bucket** + -__required__ -|The bucket containing the sequence. -|string - -|**cache** + -__required__ -|The sequence's cache size. -|integer - -|**cycle** + -__required__ -|Whether the sequence is set to cycle. -|boolean - -|**increment** + -__required__ -|The sequence step value. -|integer - -|**min** + -__required__ -|The minimum value permitted for the sequence. -|integer - -|**max** + -__required__ -|The maximum value permitted for the sequence. -|integer - -|**name** + -__required__ -|The name of the sequence. -|string - -|**namespace** + -__required__ -|Namespace to which the sequence belongs. -|string - -|**namespace_id** + -__required__ -|ID of the namespace to which the sequence belongs. -|string - -|**path** + -__required__ -|The fully qualified sequence name. -|string - -|**scope_id** + -__required__ -|ID of the scope to which the sequence belongs. -|string - -|**value** + -__required__ -|The current value of the sequence on each Query node. -| <> object -|=== - -[[value]] -**Values** - -[options="header", cols="~a,~a,~a"] -|=== -|Name|Description|Schema - -|**** + -__required__ -|The name of this property is the UUID of a Query node. - -The value of this property is the current value of the sequence on that node. -|Integer - -|**~next_block** + -__optional__ -|The starting vale of the next block of values that can be reserved for the sequence. -|Integer +s| Profile is ... +3+s| Query returns ... +3+s| Catalog includes ... + +s| {blank} +s| cbq +s| REST API +s| Query + +workbench +s| Active + +Requests +s| Completed + +Requests +s| Prepared + +Statements + +| `off` +a| {blank} +a| {blank} +a| {blank} +a| icon:check[fw] phases +a| icon:check[fw] phases +a| icon:check[fw] timings + +| `phases` +a| icon:check[fw] phases +a| icon:check[fw] phases +a| {blank} +a| icon:check[fw] phases +a| icon:check[fw] phases +a| icon:check[fw] timings + +| `timings` +a| [%hardbreaks] +icon:check[fw] phases +icon:check[fw] timings +a| [%hardbreaks] +icon:check[fw] phases +icon:check[fw] timings +a| {blank} +a| [%hardbreaks] +icon:check[fw] phases +icon:check[fw] timings +a| [%hardbreaks] +icon:check[fw] phases +icon:check[fw] timings +a| icon:check[fw] timings |=== -For further details, see xref:n1ql:n1ql-language-reference/createsequence.adoc[]. - -[#sys-all-sequences] -== Monitor All Sequences - -The `system:all_sequences` catalog maintains a list of all defined sequences. -To see the list of all defined sequences, use: - -[source,sqlpp] ----- -SELECT * FROM system:all_sequences; ----- - -This will result in a list similar to: - -[source,json] ----- -[ - { - "sequences": { - "bucket": "travel-sample", - "cache": 50, - "cycle": false, - "increment": -1, - "max": 9223372036854776000, - "min": 0, - "name": "seq4", - "namespace": "default", - "namespace_id": "default", - "path": "`default`:`travel-sample`.`inventory`.`seq4`", - "scope_id": "inventory", - "value": { - "73428daec3c68d8632ae66b09b70f14d": 10, - "~next_block": -40 - } - } - }, - { - "sequences": { - "bucket": "travel-sample", - "cache": 50, - "cycle": true, - "increment": 5, - "max": 1000, - "min": 0, - "name": "seq3", - "namespace": "default", - "namespace_id": "default", - "path": "`default`:`travel-sample`.`inventory`.`seq3`", - "scope_id": "inventory", - "value": { - "73428daec3c68d8632ae66b09b70f14d": 5, - "~next_block": 255 - } - } - }, -// ... -] ----- - -This catalog gives the same information as the <> catalog. - -For further details, see xref:n1ql:n1ql-language-reference/createsequence.adoc[]. - == Related Links * Refer to xref:n1ql:n1ql-intro/sysinfo.adoc[Getting System Information] for more information on the system namespace.