Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
josephschorr committed May 10, 2024
1 parent e7aadc7 commit 8cddb42
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions internal/datastore/spanner/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,13 @@ func (sd *spannerDatastore) Statistics(ctx context.Context) (datastore.Stats, er
}); err != nil {
return datastore.Stats{}, fmt.Errorf("unable to read tuples byte count: %w", err)
}

fmt.Println("got byte estimate", byteEstimate, queryRelationshipByteEstimate)

if byteEstimate.IsNull() {
fmt.Println("byte estimate is null")

var tableName string
var byteEstimate spanner.NullInt64
if err := sd.client.Single().Query(ctx, spanner.Statement{SQL: `SELECT used_bytes,table_name FROM ` + sd.tableSizesStatsTable}).Do(func(r *spanner.Row) error {
return r.Columns(&byteEstimate, &tableName)
lookupSingleEstimate := fmt.Sprintf(`SELECT used_bytes FROM %s WHERE table_name = '%s'`, sd.tableSizesStatsTable, tableRelationship)
if err := sd.client.Single().Query(ctx, spanner.Statement{SQL: lookupSingleEstimate}).Do(func(r *spanner.Row) error {
return r.Columns(&byteEstimate)
}); err != nil {
fmt.Println("error reading byte estimate", err)
}

fmt.Println("got single row byte estimate", byteEstimate, tableName)
}

return datastore.Stats{
Expand Down

0 comments on commit 8cddb42

Please sign in to comment.