workload/kv: add --secondary-index flag#31573
Conversation
pkg/workload/kv/kv.go
Outdated
| }, | ||
| PostLoad: func(sqlDB *gosql.DB) error { | ||
| if w.secondaryIndex { | ||
| _, err := sqlDB.Exec(`CREATE INDEX IF NOT EXISTS v_idx ON kv (v)`) |
There was a problem hiding this comment.
Is this going to be backfilled in the background? If so, the impact of that will be pretty nondeterministic. Maybe that doesn't matter now, but perhaps call it out on the flag.
a-robinson
left a comment
There was a problem hiding this comment.
LGTM, although I'm also curious about the fact that creating the index is done PostLoad rather than PreLoad. I assume it's just meant to rely on the fact that we don't use fixtures for kv?
|
Both questions here are good and I had similar ones while making the change. Putting this in |
danhhz
left a comment
There was a problem hiding this comment.
I would advocate for changing the schema based on the flag so it will work better with fixtures. tpcc adds foreign keys in PostLoad, but it's very careful to make the indexes needed for those foreign keys ahead of time in the schema (which means they're in the fixtures).
pkg/workload/kv/kv.go
Outdated
| }, | ||
| PostLoad: func(sqlDB *gosql.DB) error { | ||
| if w.secondaryIndex { | ||
| _, err := sqlDB.Exec(`CREATE INDEX IF NOT EXISTS v_idx ON kv (v)`) |
There was a problem hiding this comment.
if you keep this as PostLoad, it should be marked as a runtime-only flag, since it doesn't affect fixtures here
The flag instructs schema initialization to add a secondary index on the `v` column. This has been useful for experimenting with the perf impact of secondary indexes. Release note: None
Done. Looks much better. |
76a68f5 to
9c7b556
Compare
|
TFTRs. bors r+ |
Build failed (retrying...) |
31573: workload/kv: add --secondary-index flag r=nvanbenschoten a=nvanbenschoten The flag instructs schema initialization to add a secondary index on the `v` column. This has been useful for experimenting with the perf impact of secondary indexes. Release note: None Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
Build succeeded |
The flag instructs schema initialization to add a secondary index
on the
vcolumn. This has been useful for experimenting with theperf impact of secondary indexes.
Release note: None