You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
query:=`SELECT crdb_internal.pb_to_json('hintpb.StatementHintUnion', hint)->'injectHints'->>'donorSql' AS donor_sql FROM system.statement_hints WHERE fingerprint = $1 ORDER BY "created_at"`
Copy file name to clipboardExpand all lines: pkg/sql/explain_bundle_test.go
+38Lines changed: 38 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1178,6 +1178,44 @@ CREATE TABLE users(id UUID DEFAULT gen_random_uuid() PRIMARY KEY, promo_id INT R
1178
1178
)
1179
1179
})
1180
1180
1181
+
t.Run("statement hints", func(t*testing.T) {
1182
+
r.Exec(t, "CREATE TABLE table161829(x INT PRIMARY KEY, y INT)")
1183
+
r.Exec(t, "CREATE INDEX xy161829 ON table161829 (x, y)")
1184
+
r.Exec(t, "CREATE INDEX y161829 ON table161829 (y)")
1185
+
r.Exec(t, `SELECT information_schema.crdb_rewrite_inline_hints('SELECT * FROM table161829 WHERE y = 10', 'SELECT * FROM table161829@primary WHERE y = 10')`)
1186
+
r.Exec(t, `SELECT information_schema.crdb_rewrite_inline_hints('SELECT * FROM table161829 WHERE y = 10', 'SELECT * FROM table161829@xy161829 WHERE y = 10')`)
1187
+
r.Exec(t, `SELECT information_schema.crdb_rewrite_inline_hints('SELECT * FROM table161829 WHERE y = 10', 'SELECT * FROM table161829@y161829 WHERE y = 10')`)
1188
+
1189
+
rows:=r.QueryStr(t, "EXPLAIN ANALYZE (DEBUG) SELECT * FROM table161829 WHERE y = 10")
0 commit comments