Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/benches/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct EnvParser {
subgroup: Option<String>,

#[arg(env = "BENCH_QUERY")]
query: Option<i32>,
query: Option<String>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could fix the filtering logic to accept an arbitrary string? Or match either with or without the suffix?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the code it seems we could do something like:

if let Some(query) = &args.query {
    // Accept `1`, `01`, `6a`, `Q06a`, ... case-insensitively.
    // Bench names are canonical, e.g. `Q01`, `Q06a`.
    let q = query.trim_start_matches(['Q', 'q']);
    let split = q.find(|c: char| !c.is_ascii_digit()).unwrap_or(q.len());
    let (num, suffix) = q.split_at(split);
    let normalized = format!("Q{num:0>2}{suffix}");
    val.retain(|bench| bench.name().eq_ignore_ascii_case(&normalized));
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that seems smarter. I encountered the issue isolating an OOM with a query and as it was before I couldn't run the individual benchmark. I'll update this tomorrow.

}

pub fn sql(c: &mut Criterion) {
Expand Down
35 changes: 35 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/01a.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name Q01a
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(mc.note) AS production_note,
MIN(t.title) AS movie_title,
MIN(t.production_year) AS movie_year
FROM company_type AS ct,
info_type AS it,
movie_companies AS mc,
movie_info_idx AS mi_idx,
title AS t
WHERE ct.kind = 'production companies'
AND it.info = 'top 250 rank'
AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%'
AND (mc.note LIKE '%(co-production)%'
OR mc.note LIKE '%(presents)%')
AND ct.id = mc.company_type_id
AND t.id = mc.movie_id
AND t.id = mi_idx.movie_id
AND mc.movie_id = mi_idx.movie_id
AND it.id = mi_idx.info_type_id;

result sql_benchmarks/imdb/results/01a.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
34 changes: 34 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/01b.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name Q01b
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(mc.note) AS production_note,
MIN(t.title) AS movie_title,
MIN(t.production_year) AS movie_year
FROM company_type AS ct,
info_type AS it,
movie_companies AS mc,
movie_info_idx AS mi_idx,
title AS t
WHERE ct.kind = 'production companies'
AND it.info = 'bottom 10 rank'
AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%'
AND t.production_year BETWEEN 2005 AND 2010
AND ct.id = mc.company_type_id
AND t.id = mc.movie_id
AND t.id = mi_idx.movie_id
AND mc.movie_id = mi_idx.movie_id
AND it.id = mi_idx.info_type_id;

result sql_benchmarks/imdb/results/01b.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
35 changes: 35 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/01c.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name Q01c
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(mc.note) AS production_note,
MIN(t.title) AS movie_title,
MIN(t.production_year) AS movie_year
FROM company_type AS ct,
info_type AS it,
movie_companies AS mc,
movie_info_idx AS mi_idx,
title AS t
WHERE ct.kind = 'production companies'
AND it.info = 'top 250 rank'
AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%'
AND (mc.note LIKE '%(co-production)%')
AND t.production_year >2010
AND ct.id = mc.company_type_id
AND t.id = mc.movie_id
AND t.id = mi_idx.movie_id
AND mc.movie_id = mi_idx.movie_id
AND it.id = mi_idx.info_type_id;

result sql_benchmarks/imdb/results/01c.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
34 changes: 34 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/01d.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name Q01d
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(mc.note) AS production_note,
MIN(t.title) AS movie_title,
MIN(t.production_year) AS movie_year
FROM company_type AS ct,
info_type AS it,
movie_companies AS mc,
movie_info_idx AS mi_idx,
title AS t
WHERE ct.kind = 'production companies'
AND it.info = 'bottom 10 rank'
AND mc.note NOT LIKE '%(as Metro-Goldwyn-Mayer Pictures)%'
AND t.production_year >2000
AND ct.id = mc.company_type_id
AND t.id = mc.movie_id
AND t.id = mi_idx.movie_id
AND mc.movie_id = mi_idx.movie_id
AND it.id = mi_idx.info_type_id;

result sql_benchmarks/imdb/results/01d.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
30 changes: 30 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/02a.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name Q02a
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(t.title) AS movie_title
FROM company_name AS cn,
keyword AS k,
movie_companies AS mc,
movie_keyword AS mk,
title AS t
WHERE cn.country_code ='[de]'
AND k.keyword ='character-name-in-title'
AND cn.id = mc.company_id
AND mc.movie_id = t.id
AND t.id = mk.movie_id
AND mk.keyword_id = k.id
AND mc.movie_id = mk.movie_id;

result sql_benchmarks/imdb/results/02a.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
30 changes: 30 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/02b.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name Q02b
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(t.title) AS movie_title
FROM company_name AS cn,
keyword AS k,
movie_companies AS mc,
movie_keyword AS mk,
title AS t
WHERE cn.country_code ='[nl]'
AND k.keyword ='character-name-in-title'
AND cn.id = mc.company_id
AND mc.movie_id = t.id
AND t.id = mk.movie_id
AND mk.keyword_id = k.id
AND mc.movie_id = mk.movie_id;

result sql_benchmarks/imdb/results/02b.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
30 changes: 30 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/02c.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name Q02c
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(t.title) AS movie_title
FROM company_name AS cn,
keyword AS k,
movie_companies AS mc,
movie_keyword AS mk,
title AS t
WHERE cn.country_code ='[sm]'
AND k.keyword ='character-name-in-title'
AND cn.id = mc.company_id
AND mc.movie_id = t.id
AND t.id = mk.movie_id
AND mk.keyword_id = k.id
AND mc.movie_id = mk.movie_id;

result sql_benchmarks/imdb/results/02c.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
30 changes: 30 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/02d.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name Q02d
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(t.title) AS movie_title
FROM company_name AS cn,
keyword AS k,
movie_companies AS mc,
movie_keyword AS mk,
title AS t
WHERE cn.country_code ='[us]'
AND k.keyword ='character-name-in-title'
AND cn.id = mc.company_id
AND mc.movie_id = t.id
AND t.id = mk.movie_id
AND mk.keyword_id = k.id
AND mc.movie_id = mk.movie_id;

result sql_benchmarks/imdb/results/02d.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
36 changes: 36 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/03a.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name Q03a
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(t.title) AS movie_title
FROM keyword AS k,
movie_info AS mi,
movie_keyword AS mk,
title AS t
WHERE k.keyword LIKE '%sequel%'
AND mi.info IN ('Sweden',
'Norway',
'Germany',
'Denmark',
'Swedish',
'Denish',
'Norwegian',
'German')
AND t.production_year > 2005
AND t.id = mi.movie_id
AND t.id = mk.movie_id
AND mk.movie_id = mi.movie_id
AND k.id = mk.keyword_id;

result sql_benchmarks/imdb/results/03a.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
29 changes: 29 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/03b.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name Q03b
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(t.title) AS movie_title
FROM keyword AS k,
movie_info AS mi,
movie_keyword AS mk,
title AS t
WHERE k.keyword LIKE '%sequel%'
AND mi.info IN ('Bulgaria')
AND t.production_year > 2010
AND t.id = mi.movie_id
AND t.id = mk.movie_id
AND mk.movie_id = mi.movie_id
AND k.id = mk.keyword_id;

result sql_benchmarks/imdb/results/03b.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
38 changes: 38 additions & 0 deletions benchmarks/sql_benchmarks/imdb/benchmarks/03c.benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name Q03c
group imdb

echo Loading imdb tables

load sql_benchmarks/imdb/init/load_${IMDB_FILE_TYPE:-parquet}.sql

assert I
SELECT COUNT(*) > 0 from title;
----
true

run
SELECT MIN(t.title) AS movie_title
FROM keyword AS k,
movie_info AS mi,
movie_keyword AS mk,
title AS t
WHERE k.keyword LIKE '%sequel%'
AND mi.info IN ('Sweden',
'Norway',
'Germany',
'Denmark',
'Swedish',
'Denish',
'Norwegian',
'German',
'USA',
'American')
AND t.production_year > 1990
AND t.id = mi.movie_id
AND t.id = mk.movie_id
AND mk.movie_id = mi.movie_id
AND k.id = mk.keyword_id;

result sql_benchmarks/imdb/results/03c.csv

cleanup sql_benchmarks/imdb/init/cleanup.sql
Loading
Loading