Skip to content
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

insert test #2827

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 14 additions & 0 deletions enginetest/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"context"
"fmt"
"io"
"strconv"
"time"

sqle "github.com/dolthub/go-mysql-server"
"github.com/dolthub/go-mysql-server/memory"
Expand All @@ -34,10 +36,13 @@ func Example() {
ctx := sql.NewContext(context.Background(), sql.WithSession(session))
ctx.SetCurrentDatabase("mydb")

fmt.Println("starting query")
start := time.Now()
_, r, _, err := e.Query(ctx, `SELECT name, count(*) FROM mytable
WHERE name = 'John Doe'
GROUP BY name`)
checkIfError(err)
fmt.Println("query took", time.Since(start))

// Iterate results and print them.
for {
Expand Down Expand Up @@ -81,9 +86,18 @@ func createTestDatabase() *memory.DbProvider {
sql.NewRow("Evil Bob", "[email protected]"),
}

// add 10000 more rows
for i := 0; i < 40000; i++ {
rows = append(rows, sql.NewRow("John Doe", "foo"+strconv.Itoa(i)))
}

fmt.Println("starting insert")
start := time.Now()
for _, row := range rows {
table.Insert(ctx, row)
}

fmt.Println("Inserting rows took", time.Since(start))

return pro
}
Loading