Skip to content

Commit

Permalink
Use compression none
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy-li committed Jan 16, 2022
1 parent 4f9fc6b commit 4072784
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ch-bench-rust-driver/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use clickhouse_driver::prelude::*;
use std::error::Error;
use std::{error::Error, time::Instant};

async fn execute(database_url: String) -> Result<(), Box<dyn Error>> {
let pool = Pool::create(database_url.as_str())?;
let mut conn = pool.connection().await?;
let mut total: u64 = 0;
let start = Instant::now();

let mut result = conn
.query("SELECT number FROM system.numbers_mt LIMIT 500000000")
Expand All @@ -13,14 +14,14 @@ async fn execute(database_url: String) -> Result<(), Box<dyn Error>> {
while let Some(block) = result.next().await? {
total += block.row_count();
}
println!("Rows: {}", total);

let elapsed = start.elapsed();
println!("Rows: {}, elspsed: {} ms", total, elapsed.as_millis());
Ok(())
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
execute("tcp://localhost:9000".to_string()).await?;
execute("tcp://localhost:9000?compression=none".to_string()).await?;

Ok(())
}

0 comments on commit 4072784

Please sign in to comment.