Suppose I have User
and Post
types in my Dgraph schema, and I’m writing an API that receives a uid and returns the User
with that uid.
Naturally I want this API to ensure that the uid is actually that of a User
and not a Post
. I can think of two queries that achieve this:
queryA(func: uid($uid)) @filter(type(User)) {
...
}
queryB(func: type(User)) @filter(uid($uid)) {
...
}
Are these two queries equally efficient?