Back

Is there a difference in performance between getDocument() and listDocuments()?

  • 0
  • Databases
memoonlite
20 Dec, 2024, 19:24

Hello everyone! 😊

My goal is to get a single document, which I can do by either using getDocument() or listDocuments() and using a query. The result will be the same.

I was wondering, is there difference in performance between these two ways of retrieving a single document?

I would think getDocument() is more performant, because it's specifically designed to get one document. πŸ€”

TL;DR
There is a significant performance difference between `getDocument()` and `listDocuments()`. `getDocument()` is more performant as it is specifically designed to retrieve a single document and never hits the database.
Joshi
20 Dec, 2024, 19:54

getDocument() is a lot more performant because it never hits the database.

Joshi
20 Dec, 2024, 19:54

it is cached in redis

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more