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?
✗ Incorrect
After storing the query, the client sends only the query ID to reduce data transfer.
Which of the following is NOT a benefit of persisted queries?
✗ Incorrect
Persisted queries do not automatically update the schema; schema updates are separate.
If a client sends an unknown query ID, what should the server do?
✗ Incorrect
The server returns an error to indicate the query ID is not recognized.
Persisted queries help prevent which of the following?
✗ Incorrect
By limiting queries to pre-stored ones, persisted queries reduce injection attack risks.
What is the first step in using persisted queries?
✗ Incorrect
The client first sends the full query so the server can store it and assign an ID.
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.