【发布时间】:2019-06-04 22:35:45
【问题描述】:
我有一个关于获取光标的问题
目标函数: https://godoc.org/google.golang.org/appengine/datastore#Iterator.Cursor
从以下代码可以看出,获取Cursor时设置了offset https://github.com/golang/appengine/blob/master/datastore/query.go#L702-L705
当我使用 GCP 控制台的堆栈跟踪执行此函数时检查结果时,Insights 显示警告
Issue: Use of offset in datastore queries.
Description: Your app made 1 remote procedure calls to datastore.query () and datastore.next () using offset.
Recommendation: Use cursor instead of offset.
查询详情
g.co/gae/datastore/offset 10
g.co/gae/datastore/skipped 10
偏移量会影响性能和计费,我想避免这种行为 有没有办法避免使用偏移量?或者这是正确的行为?
【问题讨论】:
-
你检查过github.com/GoogleCloudPlatform/golang-samples/blob/master/… SnippetIterator_Cursor() 吗?
标签: google-app-engine go google-cloud-platform google-cloud-datastore