in reply to indexing segments

I think that your main issue here is not retrieval but storage. You say that you have a sizeable array of segments (> 100K). Are these all held in memory? If they are, it's a simple matter of using a slice, as in @foo[50000..100000].

Assuming that your data is not in memory, it must be on disk somewhere, in a flat file, or possibly a database. n the latter case, your retrieval then becomes a matter of SQL, as in:

select * from foo where ID between 50000 and 1000000
Hope this helps

--
I'm Not Just Another Perl Hacker

Replies are listed 'Best First'.
Re: Re: indexing segments
by glwtta (Hermit) on Oct 10, 2003 at 13:31 UTC
    Are these all held in memory? If they are, it's a simple matter of using a slice, as in @foo50000..100000.

    I think the way I described the problem was confusing. Yes, the array is held in memory, but the array index for each element is not related to the segment/interval values it holds.

    Each element can be represented as something along the lines of: {id => 50, start => 75000, end => 75500}