Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: PSQL and many queries

by sundialsvc4 (Abbot)
on Mar 24, 2009 at 02:59 UTC ( #752776=note: print w/replies, xml ) Need Help??


in reply to PSQL and many queries

Do it the COBOL way:

  1. Sort the file in ascending order by name, using a disk-based sort. (Don't worry... the operation is uncommonly fast.)
  2. Query the database, ORDER BY name. If you like, go ahead and extract this into another flat-file.
  3. Now you are presented with two identically sorted data-streams. The operation that you are now looking to perform is called a merge.

It is possible to perform this operation (of course, without writing any new code to do so yourself...) by processing the two files sequentially. No searching is required. “10 million records?” No problem!

(If you ever watched old sci-fi movies and wondered “what all those spinning tapes were doing” ... now you know.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://752776]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2018-06-19 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (114 votes). Check out past polls.

    Notices?