...
1# BigQuery Benchmark
2This directory contains benchmarks for BigQuery client, used primarily by library maintainers to measure changes that may affect library performance.
3
4
5## Usage
6`go run bench.go`
7
8### Flags
9`--reruns` can be used to override the default number of times a query is rerun.
10
11`--projectid` can be used to run benchmarks in a different project. If unset, the GOOGLE_CLOUD_PROJECT
12 environment variable is used.
13
14`--queryfile` can be used to override the default file which contains queries to be instrumented.
15
16`--table` can be used to specify a table to which benchmarking results should be streamed. The format for this string is in BigQuery standard SQL notation without escapes, e.g. `projectid.datasetid.tableid`
17
18`--create_table` can be used to have the benchmarking tool create the destination table prior to streaming.
19
20`--tag` allows arbitrary key:value pairs to be set. This flag can be specified multiple times.
21
22
23### Example invocations
24
25Setting all the flags
26```
27go run bench.go \
28 --reruns=5 \
29 --projectid=test_project_id \
30 --table=logging_project_id.querybenchmarks.measurements \
31 --create_table \
32 --tag=source:myhostname \
33 --tag=somekeywithnovalue \
34 --tag=experiment:special_environment_thing
35```
36
37Or, a more realistic invocation using shell substitions:
38```
39go run bench.go \
40 --reruns=5 \
41 --table=$BENCHMARK_TABLE \
42 --tag=origin:$(hostname) \
43 --tag=branch:$(git branch --show-current) \
44 --tag=latestcommit:$(git log --pretty=format:'%H' -n 1)
45```
View as plain text