这是indexloc提供的服务,不要输入任何密码
Skip to content

Using variables destroys performance #2316

@wooque

Description

@wooque

Query without variables:

{
  user_news(where: {user_id: {_eq: 1}, status: {_eq: 0}}, limit: 10, order_by: {id: desc}) {
    id
  }
}

Throughput: 3800 req/s

Query with variables:

query($user:Int, $status: Int){
  user_news(where: {user_id: {_eq: $user}, status: {_eq: $status}}, limit: 10, order_by: {id: desc}) {
    id
  }
}

Variables:

{
  "user":1,
  "status":0
}

Throughput: 980 req/s

In more complex example where I first noticed this performance drop it went from ~1500req/s to ~250req/s.

Metadata

Metadata

Labels

c/docsRelated to docse/quickfixcan be wrapped up in few hoursp/highcandidate for being included in the upcoming sprint

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions