Jump to content

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


HGeneAnthony

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.