Skip to content

Commit b1a7862

Browse files
authored
feat(spanner): update query option samples with optimizerStatisticsPackage (GoogleCloudPlatform#1438)
1 parent 8c81a90 commit b1a7862

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

spanner/src/create_client_with_query_options.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ function create_client_with_query_options($instanceId, $databaseId)
4141
{
4242
$spanner = new SpannerClient([
4343
'queryOptions' => [
44-
'optimizerVersion' => "1"
44+
'optimizerVersion' => '1',
45+
// Pin the statistics package used for this client instance to an
46+
// older version. The list of available statistics packages can be
47+
// found by querying the "INFORMATION_SCHEMA.SPANNER_STATISTICS"
48+
// table.
49+
'optimizerStatisticsPackage' => 'auto_20191128_14_47_22UTC'
4550
]
4651
]);
4752
$instance = $spanner->instance($instanceId);

spanner/src/query_data_with_query_options.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ function query_data_with_query_options($instanceId, $databaseId)
4747
'SELECT VenueId, VenueName, LastUpdateTime FROM Venues',
4848
[
4949
'queryOptions' => [
50-
'optimizerVersion' => "1"
50+
'optimizerVersion' => '1',
51+
// Pin the statistics package to the latest version just for
52+
// this query.
53+
'optimizerStatisticsPackage' => 'latest'
5154
]
5255
]
5356
);

0 commit comments

Comments
 (0)