Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The way I see it, there might be a design problem behind your question. I wonder what are you going to do with 60 million records on the client side ...
I don't think you are going to show the records to a user, because at a rate of 50 records per page, it would take 1,200,000 pages, and no user is willing to go through that, also because, reading one page per second, the task would last more than 13 days. :)
So I could see only two reasons for this behavior:
  • You need to either print a report or store the results somewhere ;
  • You need to do some calculation involving the value.
In the first case, to improve efficiency, you have no choice but to break your query into several chunks, and fetch the records it to your client. Selecting 6,000 or even 60,000 records each time is going to be a lot faster than waiting for your DBMS to allocate space for 60,000,000 records and then send them to you one by one.

The second case, though, is open for comments. Retrieving and sending 60 million records is going to take a long time to the database. Is there any way that you do all or at least part of the calculation within the database itself? Any database server is capable of some fairly complex calculation that you could exploit before taking the records to the client. If your calculation is going to end up with, say, 100,000 records, the burden to the database is going to be a lot less than getting the whole dataset.
If, for any reason, the DBMS is not able to do the entire calculation for you, you could at least try to reduce the number of records to fetch, by reviewing your algorithm, considering both the server and the client sides.

Could you tell us more about the nature of your calculation? We might be able to give you some better advice.

HTH
_ _ _ _ (_|| | |(_|>< _|

In reply to Re: Big database queries by gmax
in thread Big database queries by ezekiel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-18 13:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found