Skip to content

Commit

Permalink
test: add limit to select query
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
  • Loading branch information
harshit-gangal committed Dec 30, 2024
1 parent c0d29fe commit b215c81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions go/test/endtoend/preparestmt/bechmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
/*
export ver=v1 p=~/benchmark && go test \
-run '^$' -bench '^BenchmarkPreparedStmt' \
-benchtime 10s -count 6 -cpu 4 \
-benchtime 3s -count 6 -cpu 4 \
| tee $p/${ver}.txt
*/
func BenchmarkPreparedStmt(b *testing.B) {
Expand All @@ -35,7 +35,7 @@ func BenchmarkPreparedStmt(b *testing.B) {

// prepare statement
insertStmt := `insert into sks.t1 (name, age, email, created_at, is_active) values(?, ?, ?, current_timestamp, ?)`
selectStmt := `select id, name, age, email from sks.t1 where age between ? and ? and is_active = ?`
selectStmt := `select id, name, age, email from sks.t1 where age between ? and ? and is_active = ? limit ?`
updateStmt := `update sks.t1 set is_active = ? where id = ?`
deleteStmt := `delete from sks.t1 where is_active = ? and age = ?`

Expand Down Expand Up @@ -65,7 +65,7 @@ func BenchmarkPreparedStmt(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
age := rand.IntN(80)
r, err := sStmt.Query(age, age+20, rand.IntN(2))
r, err := sStmt.Query(age, age+20, rand.IntN(2), rand.IntN(10))
if err != nil {
b.Fatal(err)
}
Expand Down

0 comments on commit b215c81

Please sign in to comment.