0
0
GraphQLquery~5 mins

Persisted queries in GraphQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a persisted query in GraphQL?
A persisted query is a pre-stored GraphQL query saved on the server. Clients send only a query ID instead of the full query text, which improves performance and security.
Click to reveal answer
beginner
How do persisted queries improve performance?
They reduce the amount of data sent over the network because clients send only a small query ID instead of the full query text, making requests faster and lighter.
Click to reveal answer
intermediate
What is a common security benefit of using persisted queries?
Persisted queries prevent clients from sending arbitrary queries, reducing risks like injection attacks and unauthorized data access.
Click to reveal answer
intermediate
Describe the two-step process of using persisted queries.
First, the client sends the full query to the server to store it and get an ID. Later, the client sends only the ID to execute the stored query.
Click to reveal answer
intermediate
What happens if a client sends a query ID that the server does not recognize?
The server responds with an error indicating the query ID is unknown, and the client may need to send the full query again to store it.
Click to reveal answer
What does a client send to the server when using persisted queries after the query is stored?
AOnly the query ID
BThe full GraphQL query text
CThe query variables only
DThe server schema
Which of the following is NOT a benefit of persisted queries?
AReduced network usage
BImproved query security
CAutomatic schema updates
DFaster query execution
If a client sends an unknown query ID, what should the server do?
AExecute a random query
BIgnore the request
CSend the full query back
DReturn an error
Persisted queries help prevent which of the following?
ANetwork congestion
BInjection attacks
CSlow database indexing
DClient-side caching
What is the first step in using persisted queries?
AClient sends full query to store
BClient sends query ID
CServer sends query ID
DServer executes query
Explain what persisted queries are and why they are useful in GraphQL.
Think about how sending less data helps and how it protects the server.
You got /3 concepts.
    Describe the process a client and server follow to use persisted queries.
    Focus on the two-step communication between client and server.
    You got /4 concepts.