Try to search your question here, if you can't find : Ask Any Question Now ?

Is it better to query data on the front-end or backend?

HomeCategory: stackoverflowIs it better to query data on the front-end or backend?
Avatarjohn asked 2 weeks ago

I have a ‘Document’ collection, and I have a query that filters those documents based on the expiration date ( typically around 50 documents).

Those documents are being displayed in my home page.

My home page has a search button that opens up another component where search functionality takes place.

My original approach was filtering straight from the firestore, but I was monitoring the number of reads every time I “instant filtered” the collection, and it was crazy. I had around 1K read for just handful of searches.

So what I did was, I passed that query as component props to the search component so I am left with an array of object, and I simply filtered that array on the frontend, and didn’t have to deal with firestore and the crazy amount of read.
I am using a filter pipe and it is working perfectly.

What I would like to ask, would this approach slow down my application, knowing that the query will probably contain bet 50-80 documents max? I know it is not a good practice, but it is less expensive than querying straight from firestore.

Thanks in advance.

1 Answers
Best Answer
AvatarFernando answered 2 weeks ago
Your Answer

4 + 7 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com