Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b7bce26

Browse files
committed
Merge branch '197-query-id' into 'master'
feat: show query ID in the plain-text plan (#197) Closes #197 See merge request postgres-ai/joe!193
2 parents bb47cba + 4c0a5a6 commit b7bce26

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

‎pkg/pgexplain/pgexplain.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ type Explain struct {
5252
Plan Plan `json:"Plan"`
5353
Triggers []Trigger `json:"Triggers"`
5454

55-
Settings map[string]string `json:"Settings"`
56-
PlanningTime float64 `json:"Planning Time"`
57-
ExecutionTime float64 `json:"Execution Time"`
58-
TotalTime float64
55+
QueryIdentifier uint64 `json:"Query Identifier"`
56+
Settings map[string]string `json:"Settings"`
57+
PlanningTime float64 `json:"Planning Time"`
58+
ExecutionTime float64 `json:"Execution Time"`
59+
TotalTime float64
5960

6061
TotalCost float64
6162

@@ -329,6 +330,10 @@ func (ex *Explain) writeExplainText(writer io.Writer) {
329330
if len(ex.Settings) > 0 {
330331
_, _ = fmt.Fprintf(writer, "Settings: %s\n", printMap(ex.Settings))
331332
}
333+
334+
if ex.QueryIdentifier != 0 {
335+
_, _ = fmt.Fprintf(writer, "Query ID: %d\n", ex.QueryIdentifier)
336+
}
332337
}
333338

334339
func (ex *Explain) writeExplainTextWithoutCosts(writer io.Writer) {

‎pkg/pgexplain/pgexplain_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,7 @@ const InputJSON2 = `[
11651165
"Calls": 100
11661166
}
11671167
],
1168+
"Query Identifier": 1203128915683675161,
11681169
"Execution Time": 0.199
11691170
}
11701171
]`
@@ -1178,6 +1179,7 @@ const ExpectedText2 = ` Limit (cost=0.43..8.45 rows=1 width=22) (actual time=0.
11781179
Trigger ConstraintTrigger_a_1645468 for constraint fk_636678b3bd: time=12.443 calls=100
11791180
Trigger ConstraintTrigger_a_12751 for constraint fk_0c0f730375: time=0.990 calls=100
11801181
Trigger ConstraintTrigger_a_21567 for constraint fk_1fa7a5f4da: time=131.407 calls=100
1182+
Query ID: 1203128915683675161
11811183
`
11821184

11831185
const InputJSON3 = `[

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /