-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
workload: add interleavebench workload #53831
Conversation
cc @jordanlewis @asubiotto @ajwerner if you guys have any thoughts here |
37f80b8
to
4bb6644
Compare
4bb6644
to
a8a858f
Compare
03031b0
to
3ee963b
Compare
3ee963b
to
98447b6
Compare
98447b6
to
8063476
Compare
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.
I'm mostly offering nits. It might be good to get somebody else's eyes on this (maybe somebody that's actually going to use the workload).
Reviewed 2 of 2 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @yuzefovich)
pkg/workload/interleavebench/interleavebench.go, line 35 at r1 (raw file):
verbose bool interleave bool noFKs bool
It might be nice to change this to fks
to avoid the noFKs = false
double negative
pkg/workload/interleavebench/interleavebench.go, line 132 at r1 (raw file):
} if float64(b.parentCount)*math.Pow(b.ratio, float64(b.levels-1)) > 1<<33 { return errors.Errorf("%d level will have more than %d rows", b.levels-1, 1<<33)
nit: extract 1<<33
into const
pkg/workload/interleavebench/interleavebench.go, line 315 at r1 (raw file):
// Allow a maximum of 1 connection to the database. db.SetMaxOpenConns(1) db.SetMaxIdleConns(1)
nit: I would extract a const maxWorkers = 1
and use that throughout (and in the concurrency override in Validate
).
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @yuzefovich)
pkg/workload/interleavebench/interleavebench.go, line 29 at r1 (raw file):
) type interleaveBench struct {
Is there a description of what this workload does anywhere? I think it would be beneficial to have a top-level explanation comment, maybe on this struct.
8063476
to
e5264a0
Compare
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.
I think it's enough for you to take a look - I don't think this tool will be used heavily and will be (hopefully soon) deprecated together with the concept of the interleaved tables, so I think it is ok merging as is if it looks reasonable to you.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @asubiotto)
pkg/workload/interleavebench/interleavebench.go, line 29 at r1 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
Is there a description of what this workload does anywhere? I think it would be beneficial to have a top-level explanation comment, maybe on this struct.
There is a short description in Description
field below. Added a bigger comment as well.
pkg/workload/interleavebench/interleavebench.go, line 35 at r1 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
It might be nice to change this to
fks
to avoid thenoFKs = false
double negative
Done.
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.
Reviewed 1 of 1 files at r2.
Reviewable status:complete! 1 of 0 LGTMs obtained
This commit adds `interleavebench` workload that can be used to benchmark DELETE queries for interleaved and non-interleaved tables. It supports different number of levels (minimum 2), custom ratio in number of rows between levels, and several other parameters. As an example, for the following initialization ``` ./bin/workload init interleavebench --drop --interleave=false --levels=3 --hierarchy=1,3,2 --ratio=10 --intra-level-ratio=0.5 ``` these queries will be executed: ``` CREATE TABLE table0_0 (c0 INT, PRIMARY KEY (c0)); CREATE TABLE table1_0 (c0 INT, c1 INT, PRIMARY KEY (c0, c1)); CREATE TABLE table1_1 (c0 INT, c1 INT, PRIMARY KEY (c0, c1)); CREATE TABLE table1_2 (c0 INT, c1 INT, PRIMARY KEY (c0, c1)); CREATE TABLE table2_0 (c0 INT, c1 INT, c2 INT, PRIMARY KEY (c0, c1, c2)); CREATE TABLE table2_1 (c0 INT, c1 INT, c2 INT, PRIMARY KEY (c0, c1, c2)); ALTER TABLE table1_0 ADD CONSTRAINT fk FOREIGN KEY (c0) REFERENCES table0_0(c0) ON DELETE CASCADE; ALTER TABLE table1_1 ADD CONSTRAINT fk FOREIGN KEY (c0) REFERENCES table0_0(c0) ON DELETE CASCADE; ALTER TABLE table1_2 ADD CONSTRAINT fk FOREIGN KEY (c0) REFERENCES table0_0(c0) ON DELETE CASCADE; ALTER TABLE table2_0 ADD CONSTRAINT fk FOREIGN KEY (c0, c1) REFERENCES table1_0(c0, c1) ON DELETE CASCADE; ALTER TABLE table2_1 ADD CONSTRAINT fk FOREIGN KEY (c0, c1) REFERENCES table1_0(c0, c1) ON DELETE CASCADE; INSERT INTO table0_0 (SELECT i FROM generate_series(1, 100) AS i); INSERT INTO table1_0 (SELECT floor((i-1)*0.10)::INT+1, i FROM generate_series(1, 1000) AS i); INSERT INTO table1_1 (SELECT floor((i-1)*0.20)::INT+1, i FROM generate_series(1, 500) AS i); INSERT INTO table1_2 (SELECT floor((i-1)*0.40)::INT+1, i FROM generate_series(1, 250) AS i); INSERT INTO table2_0 (SELECT floor((i-1)*0.01)::INT+1, floor((i-1)*0.10)::INT+1, i FROM generate_series(1, 10000) AS i); INSERT INTO table2_1 (SELECT floor((i-1)*0.02)::INT+1, floor((i-1)*0.20)::INT+1, i FROM generate_series(1, 5000) AS i); ``` Then, during `run` the workload can execute DELETE queries like: ``` DELETE FROM table0 WHERE c0 IN ($1, $2, ...); ``` or ``` DELETE FROM table0 WHERE c0 >= $1 AND c0 < $1 + 1; ``` The table from which to delete as well as the number of rows to be deleted by one query can be customized. The workload does keep track of which rows are deleted in order to issue non-overlapping deletes. That is why it ignores `concurrency` flag and always runs with no concurrency. Release note: None
e5264a0
to
2093328
Compare
TFTR! bors r+ |
Build succeeded: |
This commit adds
interleavebench
workload that can be used to benchmarkDELETE queries for interleaved and non-interleaved tables. It supports
different number of levels (minimum 2), custom ratio in number of rows
between levels, and several other parameters.
As an example, for the following initialization
these queries will be executed:
Then, during
run
the workload can execute DELETE queries like:or
The table from which to delete as well as the number of rows to be deleted
by one query can be customized.
The workload does keep track of which rows are deleted in order to issue
non-overlapping deletes. That is why it ignores
concurrency
flag andalways runs with no concurrency.
Fixes: #53455.
Release note: None