Hello. I would like to share some observations. Recently H2 got a Geometry type, logic around it seems is growing, also some extra tiers like H2GIS are under development. All together this seems as a future of spatial support in H2. But already for many years the spatial support was provided by a combination of geodb + hatbox libraries and integration in GeoTools world (as H2 data store interface for storing/managing spatial features with geometries). All these was done on BLOB type where a geometry WKB is stored.
BLOB became completely useless as a type for handling WKB of geometries. Because of this change that any access of BLOB value makes a copy of it. HATBOX and GEODB libs based on JTS library provide functions to work with WKB. But any call of these functions makes a read of BLOB value which makes a copy in memory. Some spatial conflation operations being not-optimized (having polynomial complexity with applying spatial predicates between any combination of input geometries from 2 tables e.g.) now have a catastrophic performance and memory consumption. Cases where old H2 just worked 10 secods performing some kind of spatial operation between 2 layers (tables) now runs 2 hours , 3Gb of database file (instead of 400Mb normally) and outofmemory error finally. And long cleanings of temporary LOB storage on app start, app close, transaction commit after such operations. I understand real reasons of this BLOB copying approach. But the conclusion is that BLOB is not a right type for geometries. In typical GIS (like UDIG) thousands of records are extracted every second for multiple layers during rendering and other types of requests need geometries. Now BLOB became inefficient. Alltogether very likely I will do refactoring of geodb, hatbox and GeoTools to work with GEOMETRY type which is basically VARBINARY kind of which means WKB is just read to memory. But it is what usually is needed to GIS app - to get a geometry almost every time when data is read. Also because JTS geometry is lazily cached in ValueGeometry various logic in H2 (like custom spatial functions call multiple times) gets benefits. I think H2GIS toolkit more or less uses this approach already. The only concern is that are there any limitations for cases like "lake boundary" that consists from hundreds of thousands of vertices.. Isn't it 2Gb is a limit for binary types? Then it's fine.. But how do older PageStore and modern MVStore handle this type? Any performance issues? Vitali. -- 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/d/optout.
