Skip to content

Commit

Permalink
Update bench (postgres) : Added hair_color filter to `complex_query…
Browse files Browse the repository at this point in the history
…_by_name`
  • Loading branch information
nurmohammed840 committed Aug 2, 2024
1 parent 4763e7c commit 8f7a5f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions diesel_bench/benches/postgres_benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 161,13 @@ pub fn bench_medium_complex_query_by_name(b: &mut Bencher, size: usize) {
let query = client
.prepare(
"SELECT u.id as myuser_id, u.name, u.hair_color, p.id as post_id, p.user_id, p.title, p.body \
FROM users as u LEFT JOIN posts as p on u.id = p.user_id",
FROM users as u LEFT JOIN posts as p on u.id = p.user_id WHERE u.hair_color = $1",
)
.unwrap();

b.iter(|| {
client
.query_raw(&query, NO_PARAMS)
.query_raw(&query, &[&"black"])
.unwrap()
.map(|row| {
let user = User {
Expand Down
4 changes: 2 additions & 2 deletions diesel_bench/benches/tokio_postgres_benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 209,7 @@ pub fn bench_medium_complex_query_by_name(b: &mut Bencher, size: usize) {
let query = client
.prepare(
"SELECT u.id as myuser_id, u.name, u.hair_color, p.id as post_id, p.user_id, p.title, p.body \
FROM users as u LEFT JOIN posts as p on u.id = p.user_id",
FROM users as u LEFT JOIN posts as p on u.id = p.user_id WHERE u.hair_color = $1",
)
.await
.unwrap();
Expand All @@ -219,7 219,7 @@ pub fn bench_medium_complex_query_by_name(b: &mut Bencher, size: usize) {
b.iter(|| {
runtime.block_on(async {
client
.query_raw(&query, NO_PARAMS)
.query_raw(&query, &[&"black"])
.await
.unwrap()
.map(|row| {
Expand Down

0 comments on commit 8f7a5f6

Please sign in to comment.