Hi, I think what happens is that the database is not closed sometimes (the process is killed). In this case H2 re-creates the 'dirty' indexes (the indexes that were changed) the next time you start the database. This can take a long time. If you append ;LOG=2 to the database URL, this will not happen. See also http://www.h2database.com/html/grammar.html#set_log
This only happens with version 1.1.x. With version 1.2.x (when using the 'page store') index don't need to be re-built at startup (because the transaction log format changed). So upgrading to version 1.2.125 will also solve the problem. Regards, Thomas On Tue, Dec 8, 2009 at 9:46 AM, Mikkel Kamstrup Erlandsen <[email protected]> wrote: > 2009/12/8 Sylvain Pointeau <[email protected]>: >> for opening the connection I use: >> >> Class.forName("org.h2.Driver"); >> >> Connection conn = DriverManager.getConnection("jdbc:h2:/mydir/myapp/mydb", >> "sa", ""); > > Ok, nothing funky in there as far as I can see. > >> Should I remove the SHUTDOWN command sent to H2? > > Nah, I don't think it makes any difference. I am sorry, but I am a bit > at a loss as to what could be your problem... > > Cheers, > Mikkel > >> On Tue, Dec 8, 2009 at 8:25 AM, Mikkel Kamstrup Erlandsen >> <[email protected]> wrote: >>> >>> 2009/12/7 Sylvain Pointeau <[email protected]>: >>> > Hi, >>> > I did what you suggest, opening it with the shell and then "quit" to >>> > properly close the DB. >>> > yes it goes faster to open it after that but still it uses 8 seconds. >>> > Is this time linear with the db size? >>> > I put 1GB to the java process. >>> > the other thing is that I used: >>> > StatementUtils.execute( conn, "SHUTDOWN"); >>> > conn.close(); >>> > for closing the connection, >>> > is it bad? >>> >>> I simply close the JDBC connection. AFAIK H2 has a shutdown hook in >>> the JVM to properly clean up. >>> >>> On my 22GB database I still only see a few seconds worth of startup? >>> What JDBC URL are you opening the DB with? >>> >>> -- >>> Cheers, >>> Mikkel >>> >>> -- >>> >>> 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. >>> >>> >> >> -- >> >> 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. >> > > > > -- > Cheers, > Mikkel > > -- > > 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. > > > -- 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.
