-
Notifications
You must be signed in to change notification settings - Fork 2.3k
adding benchmark query with lots of rows #1703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new benchmark function, Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (19)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
benchmark_test.go (1)
116-155
: Good addition of the benchmark for large result sets.The new benchmark effectively tests the performance of retrieving and scanning a large number of rows, which is a valuable addition to the benchmark suite. This will help track driver performance for large result set processing.
A few suggestions for improvement:
- Add
b.ReportAllocs()
beforeb.StartTimer()
to report memory allocations (consistent with other benchmarks in this file).- Add a check for
rows.Err()
after the scanning loop to catch any errors that occurred during iteration.- Consider adding a brief comment explaining the benchmark's purpose and the dependency on MariaDB's
seq_1_to_10000
table.func BenchmarkSelect10000rows(b *testing.B) { db := initDB(b, false) defer db.Close() // Check if we're using MariaDB var version string err := db.QueryRow("SELECT @@version").Scan(&version) if err != nil { b.Fatalf("Failed to get server version: %v", err) } if !strings.Contains(strings.ToLower(version), "mariadb") { b.Skip("Skipping benchmark as it requires MariaDB sequence table") return } + b.ReportAllocs() b.StartTimer() stmt, err := db.Prepare("SELECT * FROM seq_1_to_10000") if err != nil { b.Fatalf("Failed to prepare statement: %v", err) } defer stmt.Close() for n := 0; n < b.N; n++ { rows, err := stmt.Query() if err != nil { b.Fatalf("Failed to query 10000rows: %v", err) } var id int64 for rows.Next() { err = rows.Scan(&id) if err != nil { rows.Close() b.Fatalf("Failed to scan row: %v", err) } } + if err = rows.Err(); err != nil { + rows.Close() + b.Fatalf("Error during row iteration: %v", err) + } rows.Close() } b.StopTimer() }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
benchmark_test.go
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (18)
- GitHub Check: test (macos-latest, 1.24, mariadb-10.11)
- GitHub Check: test (windows-latest, 1.24, mariadb-10.6)
- GitHub Check: test (macos-latest, 1.24, mariadb-11.4)
- GitHub Check: test (macos-latest, 1.24, mariadb-11.2)
- GitHub Check: test (ubuntu-latest, 1.22, 9.0)
- GitHub Check: test (windows-latest, 1.24, mariadb-10.11)
- GitHub Check: test (macos-latest, 1.24, 8.0)
- GitHub Check: test (windows-latest, 1.24, 5.7)
- GitHub Check: test (windows-latest, 1.24, 9.0)
- GitHub Check: test (windows-latest, 1.24, mariadb-10.5)
- GitHub Check: test (windows-latest, 1.24, mariadb-11.2)
- GitHub Check: test (windows-latest, 1.24, 8.4)
- GitHub Check: test (windows-latest, 1.24, mariadb-11.4)
- GitHub Check: test (macos-latest, 1.24, mariadb-11.1)
- GitHub Check: test (ubuntu-latest, 1.24, mariadb-10.5)
- GitHub Check: test (windows-latest, 1.24, mariadb-11.1)
- GitHub Check: test (windows-latest, 1.24, 8.0)
- GitHub Check: test (ubuntu-latest, 1.24, 5.7)
Sorry. I missed there is BenchmarkReceiveMassiveRows already. |
Description
created only a benchmark addition for #1697
Checklist
Summary by CodeRabbit