cockroach: github.com/cockroachdb/cockroach/pkg/bench Index | Files | Directories

package bench

import "github.com/cockroachdb/cockroach/pkg/bench"

Index

Package Files

foreachdb.go query.go setup.go

func CreateAndConnect Uses

func CreateAndConnect(pgURL url.URL, name string) (*gosql.DB, error)

CreateAndConnect connects and creates the requested DB (dropping if exists) then returns a new connection to the created DB.

func ExecPgbench Uses

func ExecPgbench(pgURL url.URL, dbname string, count int) (*exec.Cmd, error)

ExecPgbench returns a ready-to-run pgbench Cmd, that will run against the db specified by `pgURL`.

func ForEachDB Uses

func ForEachDB(b *testing.B, fn BenchmarkFn)

ForEachDB iterates the given benchmark over multiple database engines.

func RunOne Uses

func RunOne(db sqlutils.DBHandle, r *rand.Rand, accounts int) error

RunOne executes one iteration of the query batch that `pgbench` executes. Calls b.Fatalf if it encounters an error.

func SetupBenchDB Uses

func SetupBenchDB(db sqlutils.DBHandle, accounts int, quiet bool) error

SetupBenchDB sets up a db with the schema and initial data used by `pgbench`. The `-i` flag to `pgbench` is usually used to do this when testing postgres but the statements it generates use postgres-specific flags that cockroach does not support. The queries this script runs are based on a dump of a db created by `pgbench -i`, but sticking to the compatible subset that both cockroach and postgres support.

func SetupExec Uses

func SetupExec(pgURL url.URL, name string, accounts, transactions int) (*exec.Cmd, error)

SetupExec creates and fills a DB and prepares a `pgbench` command to be run against it.

type BenchmarkFn Uses

type BenchmarkFn func(b *testing.B, db *sqlutils.SQLRunner)

BenchmarkFn is a function that runs a benchmark using the given SQLRunner.

Directories

PathSynopsis
ddl_analysis

Package bench imports 19 packages (graph). Updated 2020-08-09. Refresh now. Tools for package owners.