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
144420: builtins: remove crdb_internal.reset_insights_tables r=xinhaoz a=xinhaoz
This commit removes the crdb_internal.reset_insights_tables builtin and its
related interface method on the sql stats controller, as these tables are never
populated.
Epic: none
Release note: None
Co-authored-by: Xin Hao Zhang <[email protected]>
// Give the query runner privilege to insert into the insights tables.
265
-
sqlDB.Exec(t, "INSERT INTO system.users VALUES ('node', NULL, true, 3)")
266
-
sqlDB.Exec(t, "GRANT node TO root")
267
-
268
-
// Insert into system.statement_execution_insights table
269
-
sqlDB.Exec(t, `
270
-
INSERT INTO system.public.statement_execution_insights (
271
-
session_id,
272
-
transaction_id,
273
-
transaction_fingerprint_id,
274
-
statement_id,
275
-
statement_fingerprint_id,
276
-
problem,
277
-
causes,
278
-
query,
279
-
status,
280
-
start_time,
281
-
end_time,
282
-
full_scan,
283
-
user_name,
284
-
app_name,
285
-
user_priority,
286
-
database_name,
287
-
plan_gist,
288
-
retries,
289
-
last_retry_reason,
290
-
execution_node_ids,
291
-
index_recommendations,
292
-
implicit_txn,
293
-
cpu_sql_nanos,
294
-
error_code,
295
-
contention_time,
296
-
contention_info,
297
-
details
298
-
)
299
-
VALUES (
300
-
'178b8f4d507072200000000000000001',
301
-
'14a07bbc-dfdb-41df-9231-b6235943847d',
302
-
'\xd98ea7ce7040ab94',
303
-
'178b8f50ab40d8680000000000000001',
304
-
'\x125167e869920859',
305
-
1,
306
-
'{}',
307
-
'SELECT a.balance, b.balance FROM insights_workload_table_0 AS a LEFT JOIN insights_workload_table_1 AS b ON a.shared_key = b.shared_key WHERE a.balance < _',
308
-
1,
309
-
'2023-10-06 15:47:41',
310
-
'2023-10-06 15:47:42',
311
-
't',
312
-
'root',
313
-
'insights_tables_reset',
314
-
'normal',
315
-
'insights',
316
-
'AgHmAQIACgAAAAHkAQIACgAAAAMJAgICAAAFBAYE',
317
-
0,
318
-
null,
319
-
'{}',
320
-
'{"creation : CREATE INDEX ON insights.public.insights_workload_table_0 (balance) STORING (shared_key);"}',
321
-
't',
322
-
0,
323
-
'XXUUU',
324
-
null,
325
-
null,
326
-
'{}'
327
-
)
328
-
`)
329
-
//Insert into system.transaction_execution_insights table
330
-
sqlDB.Exec(t, `
331
-
INSERT INTO system.public.transaction_execution_insights (
332
-
session_id,
333
-
transaction_id,
334
-
transaction_fingerprint_id,
335
-
stmt_execution_ids,
336
-
problems,
337
-
causes,
338
-
query_summary,
339
-
status,
340
-
start_time,
341
-
end_time,
342
-
user_name,
343
-
app_name,
344
-
user_priority,
345
-
retries,
346
-
last_retry_reason,
347
-
implicit_txn,
348
-
cpu_sql_nanos,
349
-
last_error_code,
350
-
contention_time,
351
-
contention_info,
352
-
details
353
-
354
-
)
355
-
VALUES (
356
-
'178b8f4d507072200000000000000001',
357
-
'14a07bbc-dfdb-41df-9231-b6235943847d',
358
-
'\xd98ea7ce7040ab94',
359
-
'{"178b8f50ab40d8680000000000000001"}',
360
-
'{1}',
361
-
'{}',
362
-
'SELECT a.balance, b.balance FROM insights_workload_table_0 AS a LEFT JOIN insights_workload_table_1 AS b ON a.shared_key = b.shared_key WHERE a.balance < _',
363
-
1,
364
-
'2023-10-06 15:47:41',
365
-
'2023-10-06 15:47:42',
366
-
'root',
367
-
'insights_tables_reset',
368
-
'normal',
369
-
0,
370
-
null,
371
-
't',
372
-
0,
373
-
'XXUUU',
374
-
null,
375
-
null,
376
-
'{}'
377
-
)
378
-
`)
379
-
380
-
// Check that system.{statement|transaction}_execution_insights tables both have 1 row.
381
-
varcountint
382
-
sqlDB.QueryRow(t, "SELECT count(*) FROM system.statement_execution_insights").Scan(&count)
383
-
require.Equal(t, 1/* expected */, count)
384
-
385
-
sqlDB.QueryRow(t, "SELECT count(*) FROM system.transaction_execution_insights").Scan(&count)
0 commit comments