From 2a89746fe08ead763989c0fb0df0346eecf16765 Mon Sep 17 00:00:00 2001 From: Rakhi Prathap Date: Fri, 10 Oct 2025 14:33:48 +0530 Subject: [PATCH 1/5] Update the query execution diagram --- .../pages/services-and-indexes/services/query-service.adoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/learn/pages/services-and-indexes/services/query-service.adoc b/modules/learn/pages/services-and-indexes/services/query-service.adoc index 8c2be40750..1c4e7d68a0 100644 --- a/modules/learn/pages/services-and-indexes/services/query-service.adoc +++ b/modules/learn/pages/services-and-indexes/services/query-service.adoc @@ -29,7 +29,11 @@ Other data stores are also included, such as the store for the local filesystem. The sequence whereby queries are executed is shown below: [#query_sequence] -image::services-and-indexes/services/querySequence.png[,820,align=left] + +[plantuml,query-execution,svg] +.... +include::indexes:partial$diagrams/query-service.puml[] +.... The client's {sqlpp} query is shown entering the Query Service at the left-hand side. The Query Processor performs its *Parse* routine, to validate the submitted statement, then creates the execution *Plan*. From 66efea83677297610c1132d12f9c4c6dc5e79597 Mon Sep 17 00:00:00 2001 From: Rakhi Prathap Date: Tue, 14 Oct 2025 09:41:45 +0530 Subject: [PATCH 2/5] update content --- .../services-and-indexes/services/query-service.adoc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/learn/pages/services-and-indexes/services/query-service.adoc b/modules/learn/pages/services-and-indexes/services/query-service.adoc index 1c4e7d68a0..4e5ed741e2 100644 --- a/modules/learn/pages/services-and-indexes/services/query-service.adoc +++ b/modules/learn/pages/services-and-indexes/services/query-service.adoc @@ -26,7 +26,7 @@ Other data stores are also included, such as the store for the local filesystem. == Query Execution -The sequence whereby queries are executed is shown below: +The following diagram shows the various elements and operations during query execution. [#query_sequence] @@ -42,6 +42,14 @@ Next, *Fetch* operations are performed by accessing the *Data Service*, and the The Query Service continues by performing additional processing, which includes *Filter*, *Aggregate*, and *Sort* operations. Note the degree of parallelism with which operations are frequently performed, represented by the vertically aligned groups of right-pointing arrows. + +When the Query Service receives the client's {sqlpp} query, it first passes it to the Query Processor. +The Query Processor parses the query to validate the statement and then creates the execution plan. +It performs *Scan* operations on the relevant index by accessing the *Index Service* or the *Search Service*. +Next, it performs *Fetch* operations by accessing the *Data Service*. The returned data is then used in *Join* operations. +The Query Service processes the data further by applying *Filter*, *Aggregate*, and *Sort* operations. +Operations often run in parallel, as represented by the vertically aligned groups of right-pointing arrows. + == Using {sqlpp} The Query Service supports queries made in {sqlpp}. From 6ca83fd8ec1409412f49c38c544c5a0690057386 Mon Sep 17 00:00:00 2001 From: Rakhi Prathap Date: Fri, 7 Nov 2025 11:26:27 +0530 Subject: [PATCH 3/5] Fix flowchart description --- .../services/query-service.adoc | 26 +++++++++---------- preview/DOC-12349-query-execution-diagram.yml | 3 +++ 2 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 preview/DOC-12349-query-execution-diagram.yml diff --git a/modules/learn/pages/services-and-indexes/services/query-service.adoc b/modules/learn/pages/services-and-indexes/services/query-service.adoc index 4e5ed741e2..a61e12e98a 100644 --- a/modules/learn/pages/services-and-indexes/services/query-service.adoc +++ b/modules/learn/pages/services-and-indexes/services/query-service.adoc @@ -35,20 +35,18 @@ The following diagram shows the various elements and operations during query exe include::indexes:partial$diagrams/query-service.puml[] .... -The client's {sqlpp} query is shown entering the Query Service at the left-hand side. -The Query Processor performs its *Parse* routine, to validate the submitted statement, then creates the execution *Plan*. -*Scan* operations are then performed on the relevant index, by accessing the *Index Service* or the *Search Service*. -Next, *Fetch* operations are performed by accessing the *Data Service*, and the data duly returned is used in *Join* operations. -The Query Service continues by performing additional processing, which includes *Filter*, *Aggregate*, and *Sort* operations. -Note the degree of parallelism with which operations are frequently performed, represented by the vertically aligned groups of right-pointing arrows. - - -When the Query Service receives the client's {sqlpp} query, it first passes it to the Query Processor. -The Query Processor parses the query to validate the statement and then creates the execution plan. -It performs *Scan* operations on the relevant index by accessing the *Index Service* or the *Search Service*. -Next, it performs *Fetch* operations by accessing the *Data Service*. The returned data is then used in *Join* operations. -The Query Service processes the data further by applying *Filter*, *Aggregate*, and *Sort* operations. -Operations often run in parallel, as represented by the vertically aligned groups of right-pointing arrows. +When the Query Service receives the client's {sqlpp} query, it immediately passes it to the Query Processor. +The Query Processor first parses the query to validate the statement and then creates an execution plan for the request. + +The Execution Engine then begins executing the plan. +It performs Scan operations on the relevant index, using either the Index Service or the Search Service. +Next, it performs Fetch operations to get the actual data from the Data Service, and then uses this data for Join operations. + +The Query Service processes the data further by applying Filter, Aggregate, Project, and Sort operations. +These operations often run in parallel, as represented by the vertically aligned groups of right-pointing arrows. +Finally, it executes Offset and Limit operations to set the result size and starting point, and then streams the results back to the client. + +For more information about each of these operations, see xref:n1ql:n1ql-language-reference/selectintro.adoc[Query Phases]. == Using {sqlpp} diff --git a/preview/DOC-12349-query-execution-diagram.yml b/preview/DOC-12349-query-execution-diagram.yml new file mode 100644 index 0000000000..29e3f40fcd --- /dev/null +++ b/preview/DOC-12349-query-execution-diagram.yml @@ -0,0 +1,3 @@ +sources: + docs-devex: + branches: [DOC-12349-query-execution-diagram] From 808f84af3977f57ba0b986ac2ed9b359d9291477 Mon Sep 17 00:00:00 2001 From: Rakhi Prathap Date: Fri, 7 Nov 2025 14:17:49 +0530 Subject: [PATCH 4/5] Minor tweak --- .../pages/services-and-indexes/services/query-service.adoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/learn/pages/services-and-indexes/services/query-service.adoc b/modules/learn/pages/services-and-indexes/services/query-service.adoc index a61e12e98a..aae681fad9 100644 --- a/modules/learn/pages/services-and-indexes/services/query-service.adoc +++ b/modules/learn/pages/services-and-indexes/services/query-service.adoc @@ -11,7 +11,8 @@ The Query Service depends on both the _Index Service_ and the _Data Service_. The architecture of the _Query Service_ is shown by the following illustration: [#query_service_architecture] -image::services-and-indexes/services/queryServiceArchitecture.png[,700,align=left] +.Query Service Architecture +image::services-and-indexes/services/queryServiceArchitecture.png[,700,align=centre] The principal components are: @@ -29,7 +30,7 @@ Other data stores are also included, such as the store for the local filesystem. The following diagram shows the various elements and operations during query execution. [#query_sequence] - +.Query Execution Phases [plantuml,query-execution,svg] .... include::indexes:partial$diagrams/query-service.puml[] From 5e0099ce6ef10b0aacd989dbfeb8d49c422f38f4 Mon Sep 17 00:00:00 2001 From: Rakhi Prathap Date: Fri, 7 Nov 2025 14:24:32 +0530 Subject: [PATCH 5/5] Minor tweak --- .../pages/services-and-indexes/services/query-service.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/learn/pages/services-and-indexes/services/query-service.adoc b/modules/learn/pages/services-and-indexes/services/query-service.adoc index aae681fad9..f5f996e7a8 100644 --- a/modules/learn/pages/services-and-indexes/services/query-service.adoc +++ b/modules/learn/pages/services-and-indexes/services/query-service.adoc @@ -27,10 +27,10 @@ Other data stores are also included, such as the store for the local filesystem. == Query Execution -The following diagram shows the various elements and operations during query execution. +The following diagram shows the sequence of operations during query execution. [#query_sequence] -.Query Execution Phases +.Query Execution Sequence [plantuml,query-execution,svg] .... include::indexes:partial$diagrams/query-service.puml[] @@ -47,7 +47,7 @@ The Query Service processes the data further by applying Filter, Aggregate, Proj These operations often run in parallel, as represented by the vertically aligned groups of right-pointing arrows. Finally, it executes Offset and Limit operations to set the result size and starting point, and then streams the results back to the client. -For more information about each of these operations, see xref:n1ql:n1ql-language-reference/selectintro.adoc[Query Phases]. +For more information about each of these operations, see xref:n1ql:n1ql-language-reference/selectintro.adoc#query-execution-phases[Query Phases]. == Using {sqlpp}