Skip to content

feat(spanner): add OrderBy feature#10289

Merged
harshachinta merged 5 commits intogoogleapis:mainfrom
mayurkale22:orderby
Jun 7, 2024
Merged

feat(spanner): add OrderBy feature#10289
harshachinta merged 5 commits intogoogleapis:mainfrom
mayurkale22:orderby

Conversation

@mayurkale22
Copy link
Copy Markdown
Contributor

@mayurkale22 mayurkale22 commented May 30, 2024

This feature is only applicable in Read API.

This option will allow users to specify whether they want the results to be returned in primary key order (PRIMARY_KEY) or in an out of order (NO_ORDER). The NO_ORDER is significantly faster than KEY_ORDER, because spanner uses higher parallelism for non-ordered reads.

Sample Usage

ctx := context.Background()
client, err := spanner.NewClient(ctx, db)
if err != nil {
    return err
}
defer client.Close()

iter := client.Single().ReadWithOptions(ctx, "Albums", spanner.AllKeys(),
                []string{"SingerId", "AlbumId", "AlbumTitle"}, ReadOptions.OrderBy(RpcOrderBy.NO_ORDER))
 defer iter.Stop()

@mayurkale22 mayurkale22 requested review from a team May 30, 2024 18:16
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label May 30, 2024
@mayurkale22 mayurkale22 requested a review from harshachinta June 4, 2024 20:40
@mayurkale22
Copy link
Copy Markdown
Contributor Author

@harshachinta, @rahul2393 Could you please review and approve this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the Spanner API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants