I would also be interested in something similar -- I am looking at tuning H2 for object,key,value stores to hold user-defined document/ object properties.
For simple key-value store, a dedicated, hash-table based system will outperform H2 or any other relational DBMS, because the DBMS is required to provide a lot more advanced features (referential integrity, transactions, etc). Lookup for these should always be ~O (1) for large numbers of items with a good hash function, rather than the O(log n) of conventional B-tree indexes. If H2 is required, and there is always a 1:1 key:value mapping (single- valued mappings), the following might be of use: For non-numeric keys, particularly strings: use hashed index option for the key column, and may the key column your table's primary key, OR apply a UNIQUE (hashed) constraint. Define the table as 'CREATE MEMORY TABLE...' rather than 'CREATE TABLE' to allow the complete indices to reside in RAM (much faster lookups). If a key may return multiple values (my use case, for multi-value properties, such as authors or graph relations, etc) you're kind of out of luck. Clustered indices are designed for that sort of thing, but AFAIK H2 doesn't support that yet; maybe when the new page store scheme is implemented? Perhaps Thomas Mueller can suggest settings (or post them on the site) for optimizing queries on large tables (>1M rows) with very simple column structures, since the defaults do not seem to work that well for that case? Cheers, Bob McGee On Jun 15, 5:59 pm, David Brown <[email protected]> wrote: > I have found with simple tables, a lot of space gets wasted in the > database store. Don't know if there is any way to improve this with > settings. > > 2009/6/15 Lukas Zapletal <[email protected]>: > > > > > Maybe: > > > SET UNDO_LOG 0 - turns off undo log (I do not need rollbacks) > > SET LOCK_MODE ? > > SET LOG ? > > > LZ > > > On 15 čvn, 22:52, Lukas Zapletal <[email protected]> wrote: > >> Hello, > > >> I am using H2 in a project that uses it as a "simple key-value > >> reliable store". Since there are some open-source key-value database > >> products written in Java I think H2 is the most reliable one. > >> Opinions? > > >> Anyway what settings do you suggest to operate in this very specific > >> mode: > > >> - there are no multi-command transactions (only set or get) > >> - each table has two columns (key and value) > >> - I am operating in embedded mode (running multiple threads) > > >> Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/h2-database?hl=en -~----------~----~----~----~------~----~------~--~---
