Hi,

> binA and binB contain basically random bytes, but again this is unrelated
to my question

Well, this is actually relevant. You have two indexes (one primary key, and
a secondary key) on randomly distributed data. There is no way to make it
really fast, unless it fits in memory. Having to use an index on randomly
distributed data is a "cache killer". All you can really do in this case is
try to load everything in memory, or use a solid state disk.

Because of that, I would avoid an index on randomly distributed data (no
matter what database is storage system you use), unless you know in advance
that the number of entries will never grow beyond a certain size, or unless
the amount of data you store is so big that the lookup cost (at most 200
per second for a regular hard disk) is lower than the amount of data. That
means, each entry is about 2 MB in size or larger.

See also the documentation at
http://h2database.com/html/datatypes.html#uuid_type

Regards,
Thomas





On Wed, Feb 5, 2014 at 11:04 AM, Noel Grandin <[email protected]> wrote:

> You could so something like:
>
> SELECT binA, binB FROM myTable ORDER BY binA LIMIT 10000
>
> and then store the last binA value you receive and go:
>
> SELECT binA, binB FROM myTable WHERE binA > lastBinAValueFromPreviousSelect
> ORDER BY binA LIMIT 10000
>
> and repeat that until you have processed all the data.
>
> Which should be reasonably snappy because it can use the primary index to
> locate the data efficiently.
>
>
> On 2014-02-05 11:43, Jan Møller wrote:
>
>>
>> On startup I wish to read through it all to generate a graph, so
>> basically: read next element, do something, rinse and
>> repeat
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to