英文:
How to force using primary key in Google cloud spanner queries?
问题
你可以在这里查看强制在Google Cloud Spanner查询中使用命名索引的示例:https://cloud.google.com/spanner/docs/sql-best-practices#postgresql_2
我想了解如何强制使用主键索引的语法。
英文:
There're examples of forcing a named index in Google cloud spanner queries here: https://cloud.google.com/spanner/docs/sql-best-practices#postgresql_2
I would like to know about the syntax of forcing primary key index.
答案1
得分: 0
你可以像任何其他索引一样引用主键。Cloud Spanner中的主键始终命名为PRIMARY_KEY
。因此,可以通过以下方式指示使用主键:
select * from test/*@ FORCE_INDEX=PRIMARY_KEY */;
英文:
You can reference the primary key in the same way as any other index. Primary keys in Cloud Spanner are always named PRIMARY_KEY
. So indicating that the primary key should be used can be achieved like this. The link you shared seems to reference the PostgreSQL
-dialect of Google Cloud Spanner, so the example uses that dialect:
select * from test/*@ FORCE_INDEX=PRIMARY_KEY */;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论