Jump to content

Is it better to get results all at once or make multiple calls


Recommended Posts

I have a list of items to return.  The list will be accessible through my object (each field with a function call) so I need to store results before I can display them.  I was wondering is it better on performance to store the results into an object array so I only need to call the database once or should I only store 1 result at a time and make multiple calls to the database?  Right now the results returned could be between 10 to 100 at a time with 5 or so fields a record.  I would think doing bulk operations would be best but with memory usage and multiple connections I don't know.  Suggestions?

Sorry I wrote that wrong.  The people aren't connecting to my db.  I plan to use a localhost user for all connections to the database but with users surfing my site at the same time I might have quite a bit of objects loaded into memory at a time if I'm saving bulk results.  Granted I plan to release the objects after I use them so it might not be bad.  But short term it will eat up more memory.  I don't know though.  I've done desktops more than websites and with a desktop I wouldn't be concerned but with a website I don't know.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.