Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive query preparations for a single query #106

Open
jorgebay opened this issue Apr 28, 2020 · 1 comment
Open

Excessive query preparations for a single query #106

jorgebay opened this issue Apr 28, 2020 · 1 comment
Labels
bug Something isn't working post alpha Out of scope of the first alpha

Comments

@jorgebay
Copy link
Contributor

As in golang map keys order is not guaranteed, multiple CQL queries are prepared given a single graphql query, when executing multiple times.

Consider the following query:

mutation {
  insertTagsByLetter(value: {firstLetter: "b", tag: "bote"}){
    applied
    value { tag }
  }
}

When executing multiple times, we generate 2 different prepared queries:

INSERT INTO "killrvideo"."tags_by_letter" ("tag", "first_letter") VALUES (?, ?)
INSERT INTO "killrvideo"."tags_by_letter" ("first_letter", "tag") VALUES (?, ?)

On larger queries, this posses a real issue as prepared statement cache might fill up and queries get evicted server side.

@jorgebay jorgebay added bug Something isn't working post alpha Out of scope of the first alpha labels Apr 28, 2020
@jorgebay
Copy link
Contributor Author

The fix is to sort the keys and use those for iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working post alpha Out of scope of the first alpha
Projects
None yet
Development

No branches or pull requests

1 participant