(b *testing.B)
| 3465 | } |
| 3466 | |
| 3467 | func BenchmarkParse(b *testing.B) { |
| 3468 | testCases := []struct { |
| 3469 | name, query string |
| 3470 | }{ |
| 3471 | { |
| 3472 | "simple", |
| 3473 | `SELECT a FROM t WHERE a = 1`, |
| 3474 | }, |
| 3475 | { |
| 3476 | "string", |
| 3477 | `SELECT a FROM t WHERE a = 'some-string' AND b = 'some-other-string'`, |
| 3478 | }, |
| 3479 | { |
| 3480 | "tpcc-delivery", |
| 3481 | `SELECT no_o_id FROM new_order WHERE no_w_id = $1 AND no_d_id = $2 ORDER BY no_o_id ASC LIMIT 1`, |
| 3482 | }, |
| 3483 | { |
| 3484 | "account", |
| 3485 | `BEGIN; |
| 3486 | UPDATE pgbench_accounts SET abalance = abalance + 77 WHERE aid = 5; |
| 3487 | SELECT abalance FROM pgbench_accounts WHERE aid = 5; |
| 3488 | INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (1, 2, 5, 77, CURRENT_TIMESTAMP); |
| 3489 | END`, |
| 3490 | }, |
| 3491 | } |
| 3492 | for _, tc := range testCases { |
| 3493 | b.Run(tc.name, func(b *testing.B) { |
| 3494 | for i := 0; i < b.N; i++ { |
| 3495 | if _, err := parser.Parse(tc.query); err != nil { |
| 3496 | b.Fatal(err) |
| 3497 | } |
| 3498 | } |
| 3499 | }) |
| 3500 | } |
| 3501 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…