Skip to content

Commit

Permalink
More sai workload files
Browse files Browse the repository at this point in the history
  • Loading branch information
pkolaczk committed Dec 7, 2021
1 parent 452ad8f commit d096c56
Show file tree
Hide file tree
Showing 6 changed files with 202 additions and 0 deletions.
33 changes: 33 additions & 0 deletions workloads/sai/read-equals-hc.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
mod common;

use common::{KEYSPACE, TABLE, LC, HC};
use latte::*;

pub const LOAD_COUNT = latte::param!("rows", 100000);

const READ_SIZE = latte::param!("read_size", 10);

const READ = "read";

pub async fn schema(db) {
common::init_schema(db).await?;
}

pub async fn erase(db) {
common::erase(db).await?;
}

pub async fn prepare(db) {
common::prepare(db).await?;
db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE}
WHERE hc = ? LIMIT ${READ_SIZE}`).await?;
}

pub async fn load(db, i) {
common::insert_row(db, i).await?;
}

pub async fn run(db, i) {
let hc = hash2(i, 26709) % HC;
db.execute_prepared(READ, [hc]).await?;
}
33 changes: 33 additions & 0 deletions workloads/sai/read-equals-lc.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
mod common;

use common::{KEYSPACE, TABLE, LC, HC};
use latte::*;

pub const LOAD_COUNT = latte::param!("rows", 100000);

const READ_SIZE = latte::param!("read_size", 10);

const READ = "read";

pub async fn schema(db) {
common::init_schema(db).await?;
}

pub async fn erase(db) {
common::erase(db).await?;
}

pub async fn prepare(db) {
common::prepare(db).await?;
db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE}
WHERE lc = ? LIMIT ${READ_SIZE}`).await?;
}

pub async fn load(db, i) {
common::insert_row(db, i).await?;
}

pub async fn run(db, i) {
let lc = hash2(i, 26709) % LC;
db.execute_prepared(READ, [lc]).await?;
}
34 changes: 34 additions & 0 deletions workloads/sai/read-intersect-lc-hc.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
mod common;

use common::{KEYSPACE, TABLE, LC, HC};
use latte::*;

pub const LOAD_COUNT = latte::param!("rows", 100000);

const READ_SIZE = latte::param!("read_size", 10);

const READ = "read";

pub async fn schema(db) {
common::init_schema(db).await?;
}

pub async fn erase(db) {
common::erase(db).await?;
}

pub async fn prepare(db) {
common::prepare(db).await?;
db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE}
WHERE lc = ? AND hc = ? LIMIT ${READ_SIZE}`).await?;
}

pub async fn load(db, i) {
common::insert_row(db, i).await?;
}

pub async fn run(db, i) {
let lc = hash2(i, 26709) % LC;
let hc = hash2(i, 67633) % HC;
db.execute_prepared(READ, [lc, hc]).await?;
}
34 changes: 34 additions & 0 deletions workloads/sai/read-intersect-lc-mc.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
mod common;

use common::{KEYSPACE, TABLE, LC, MC};
use latte::*;

pub const LOAD_COUNT = latte::param!("rows", 100000);

const READ_SIZE = latte::param!("read_size", 10);

const READ = "read";

pub async fn schema(db) {
common::init_schema(db).await?;
}

pub async fn erase(db) {
common::erase(db).await?;
}

pub async fn prepare(db) {
common::prepare(db).await?;
db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE}
WHERE lc = ? AND mc = ? LIMIT ${READ_SIZE}`).await?;
}

pub async fn load(db, i) {
common::insert_row(db, i).await?;
}

pub async fn run(db, i) {
let lc = hash2(i, 26709) % LC;
let mc = hash2(i, 6773) % MC;
db.execute_prepared(READ, [lc, mc]).await?;
}
34 changes: 34 additions & 0 deletions workloads/sai/read-union-hc-hc.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
mod common;

use common::{KEYSPACE, TABLE, HC};
use latte::*;

pub const LOAD_COUNT = latte::param!("rows", 100000);

const READ_SIZE = latte::param!("read_size", 10);

const READ = "read";

pub async fn schema(db) {
common::init_schema(db).await?;
}

pub async fn erase(db) {
common::erase(db).await?;
}

pub async fn prepare(db) {
common::prepare(db).await?;
db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE}
WHERE hc = ? OR hc = ? LIMIT ${READ_SIZE}`).await?;
}

pub async fn load(db, i) {
common::insert_row(db, i).await?;
}

pub async fn run(db, i) {
let hc1 = hash2(i, 85790) % HC;
let hc2 = hash2(i, 24303) % HC;
db.execute_prepared(READ, [hc1, hc2]).await?;
}
34 changes: 34 additions & 0 deletions workloads/sai/read-union-lc-lc.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
mod common;

use common::{KEYSPACE, TABLE, LC};
use latte::*;

pub const LOAD_COUNT = latte::param!("rows", 100000);

const READ_SIZE = latte::param!("read_size", 10);

const READ = "read";

pub async fn schema(db) {
common::init_schema(db).await?;
}

pub async fn erase(db) {
common::erase(db).await?;
}

pub async fn prepare(db) {
common::prepare(db).await?;
db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE}
WHERE lc = ? OR lc = ? LIMIT ${READ_SIZE}`).await?;
}

pub async fn load(db, i) {
common::insert_row(db, i).await?;
}

pub async fn run(db, i) {
let lc1 = hash2(i, 85790) % LC;
let lc2 = hash2(i, 24303) % LC;
db.execute_prepared(READ, [lc1, lc2]).await?;
}

0 comments on commit d096c56

Please sign in to comment.