It would be difficult to give a useful answer with the information provided. What number of queries is currently making you hesitate?
The number of queries can cause overhead due to the round-trip delay, but this will depend on a number of factors.
- Location of the database server. Same machine or different
- Database load
- Waiting for table/row access when the data is locked for writing.
But using monolithic queries can also cause overhead.
- Expensive join clauses
- Acquiring table/row locks
- Amount of data being transferred
If you can provide more information about the way you use the database we can likely offer areas to improve upon.
But honestly the best way to see which approach works best for you is to benchmark it. Optimizing before you identify the bottlenecks can absorb a huge amount of your development time with very little return on the investment.
I'm very fond of using Benchmark to determine which algorithm runs fastest, but this is only part of the problem in your case. You really need to see how well it performs when the load is as high as you fear it might become.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.