xref: /aosp_15_r20/external/googleapis/google/firestore/v1/query_profile.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.firestore.v1;
18
19import "google/api/field_behavior.proto";
20import "google/protobuf/duration.proto";
21import "google/protobuf/struct.proto";
22
23option csharp_namespace = "Google.Cloud.Firestore.V1";
24option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
25option java_multiple_files = true;
26option java_outer_classname = "QueryProfileProto";
27option java_package = "com.google.firestore.v1";
28option objc_class_prefix = "GCFS";
29option php_namespace = "Google\\Cloud\\Firestore\\V1";
30option ruby_package = "Google::Cloud::Firestore::V1";
31
32// Specification of the Firestore Query Profile fields.
33
34// Explain options for the query.
35message ExplainOptions {
36  // Optional. Whether to execute this query.
37  //
38  // When false (the default), the query will be planned, returning only
39  // metrics from the planning stages.
40  //
41  // When true, the query will be planned and executed, returning the full
42  // query results along with both planning and execution stage metrics.
43  bool analyze = 1 [(google.api.field_behavior) = OPTIONAL];
44}
45
46// Explain metrics for the query.
47message ExplainMetrics {
48  // Planning phase information for the query.
49  PlanSummary plan_summary = 1;
50
51  // Aggregated stats from the execution of the query. Only present when
52  // [ExplainOptions.analyze][google.firestore.v1.ExplainOptions.analyze] is set
53  // to true.
54  ExecutionStats execution_stats = 2;
55}
56
57// Planning phase information for the query.
58message PlanSummary {
59  // The indexes selected for the query. For example:
60  //  [
61  //    {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
62  //    {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
63  //  ]
64  repeated google.protobuf.Struct indexes_used = 1;
65}
66
67// Execution statistics for the query.
68message ExecutionStats {
69  // Total number of results returned, including documents, projections,
70  // aggregation results, keys.
71  int64 results_returned = 1;
72
73  // Total time to execute the query in the backend.
74  google.protobuf.Duration execution_duration = 3;
75
76  // Total billable read operations.
77  int64 read_operations = 4;
78
79  // Debugging statistics from the execution of the query. Note that the
80  // debugging stats are subject to change as Firestore evolves. It could
81  // include:
82  //  {
83  //    "indexes_entries_scanned": "1000",
84  //    "documents_scanned": "20",
85  //    "billing_details" : {
86  //       "documents_billable": "20",
87  //       "index_entries_billable": "1000",
88  //       "min_query_cost": "0"
89  //    }
90  //  }
91  google.protobuf.Struct debug_stats = 5;
92}
93