Should I use one big query or several API calls for user data and permissions?
#1
I'm trying to decide if I should use a single, more complex query or break it into several smaller, sequential calls to the service. The main one I'm working on needs to pull user data, their recent activity, and associated permissions, but I'm worried about the performance hit if the response gets too large.
Reply
#2
I tried a single complex query once. The payload bloated fast and latency spiked beyond what we tolerate. It felt brittle and hard to cache.
Reply
#3
Then we split into a couple of calls and pulled activity and permissions in parallel after loading the user record. Latency got better, but we spent a lot of time wiring retries, consistency checks, and a small cache for the user object.
Reply
#4
If you measure, two numbers matter: payload size and round trips. A single call trades a big payload for multiple fast calls done in parallel. But deserialization and client-side processing can eat into the gains. A quick baseline experiment could tell which path hurts more in practice.
Reply
#5
I even flirted with a batch or batch-like endpoint once, but the schema got tangled, and we dropped it. Still, I keep wondering if the real issue is the input size or the cost of serializing everything for every UI.
Reply


[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Forum Jump: