in reply to Perl - Database - List View issue

Just a thought, Why not do the select * ONCE and save all records into either a temp file or a Hash etc...

Only display what was asked for. ie 1-10 or 11-20.. then have another linmk that could re-run the query should that be necessary..?(possible fast and plenty updates/inserts)

-----
Of all the things I've lost in my life, its my mind I miss the most.

Replies are listed 'Best First'.
Re: Re: Perl - Database - List View issue
by gopi (Initiate) on Jan 10, 2003 at 10:14 UTC
    Data::Page and PageSet modules are for the list of values that we have in our hand(variables), that is not what I want. I wanted to eliminate the long processing time which takes during query execution by cutting off with limit but still be able to get the total no of count any time.

    having a select * ONCE and save it into hashes also rulled out for two reasons
    * the queries will be dynamic (same query may not come for service next time)
    * if the query is going to return say 20000 records, imagine the amount memory required to store them in RAM(it would be atleast in MBs) and perl will be smart enough not to release the memory even after the hash is destroyed, which would be used for future requests. This makes other system processes not getting the memory

    Though I am currently using the second method only, i am rulling it out because of this memory usage problem and i want to use much better algorithm than this
    Thanx anyway for replies,
    Any further suggestions are welcomed
    gopi