forked from GoogleCloudPlatform/professional-services
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add benchmark code for spanner subquery (GoogleCloudPlatform#587)
* Add benchmark code for spanner subquery * Update toplevel README * Apply suggestions from code review Co-authored-by: Jacob Ferriero <jferriero@google.com> * Fix README and benchmark pattern * Add how to stop benchmark Co-authored-by: Jacob Ferriero <jferriero@google.com>
- Loading branch information
Showing
6 changed files
with
749 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# spanner-interleave-subquery | ||
|
||
This example contains the benchmark code to examine query efficiency gains of using Cloud Spanner interleaved tables with subqueries. | ||
|
||
## Prerequisite | ||
|
||
Run the following command to create a Cloud Spanner database with [schema.sql](schema.sql). | ||
|
||
```bash | ||
gcloud spanner databases create ${DATABASE} --instance=${INSTANCE} --ddl-file=schema.sql | ||
``` | ||
|
||
## How to run the benchmark | ||
|
||
Run the following command. You might need Go 1.15 or higher. | ||
|
||
```bash | ||
go run main.go --project=${PROJECT} --instance=${INSTANCE} --database=${DATABASE} --pattern=${PATTERN} --parallel=${PARALLEL} | ||
``` | ||
|
||
For `--pattern` flag please specify the following number. | ||
|
||
1. Insert sample data. | ||
2. Run benchmark with separated queries for interleaved tables. | ||
3. Run benchmark with subqueries for interleaved tables. | ||
|
||
You might need to run `--pattern=1` prior to running the benchmark for `--pattern=2` or `--pattern=3` to insert sample data. | ||
|
||
Note that this benchmark runs forever unless you stop the process by Ctr+C (SIGINT). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module github.com/GoogleCloudPlatform/professional-services/examples/spanner-interleave-subquery | ||
|
||
go 1.15 | ||
|
||
require ( | ||
cloud.google.com/go/spanner v1.12.0 | ||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a | ||
google.golang.org/api v0.36.0 | ||
) |
Oops, something went wrong.