MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / BenchmarkParse

Function BenchmarkParse

pkg/sql/parser/parse_test.go:3467–3501  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

3465}
3466
3467func 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}

Callers

nothing calls this directly

Calls 1

ParseFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…