This example contains the benchmark code to examine query efficiency gains of using Cloud Spanner interleaved tables with subqueries.
Run the following command to create a Cloud Spanner database with schema.sql.
gcloud spanner databases create ${DATABASE} --instance=${INSTANCE} --ddl-file=schema.sql
Run the following command. You might need Go 1.15 or higher.
go run main.go --project=${PROJECT} --instance=${INSTANCE} --database=${DATABASE} --pattern=${PATTERN} --parallel=${PARALLEL}
For --pattern
flag please specify the following number.
- Insert sample data.
- Run benchmark with separated queries for interleaved tables.
- 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).