tidb: add insert benchmark.

This commit is contained in:
Ewan Chou
2016-04-03 13:09:27 +08:00
parent dbcd7364e0
commit 89650ca556

View File

@ -170,3 +170,25 @@ func BenchmarkDecimalIndexLookup(b *testing.B) {
readResult(rs[0], 1)
}
}
func BenchmarkInsertWithIndex(b *testing.B) {
b.StopTimer()
se := prepareBenchSession()
mustExecute(se, "drop table if exists t")
mustExecute(se, "create table t (pk int primary key, col int, index idx (col))")
b.StartTimer()
for i := 0; i < b.N; i++ {
mustExecute(se, fmt.Sprintf("insert t values (%d, %d)", i, i))
}
}
func BenchmarkInsertNoIndex(b *testing.B) {
b.StopTimer()
se := prepareBenchSession()
mustExecute(se, "drop table if exists t")
mustExecute(se, "create table t (pk int primary key, col int)")
b.StartTimer()
for i := 0; i < b.N; i++ {
mustExecute(se, fmt.Sprintf("insert t values (%d, %d)", i, i))
}
}