Exposed: Exposed slow

I’m trying to connect to the H2 database on an embedded device.

The connection using

Database.connect("jdbc:h2:~/testdb;DB_CLOSE_DELAY=-1", driver = "org.h2.Driver", user = "root", password = "")

takes about 7s to create/open a database, but the connection using another library, for example kotliquery

val create = measureTimeMillis {
            sess = sessionOf("jdbc:h2:~/testdb;DB_CLOSE_DELAY=-1", "root", "")
            sess.execute(queryOf("CREATE TABLE IF NOT EXISTS RandomText(ID INT PRIMARY KEY auto_increment, text VARCHAR(15));"))
        }

takes about 2s.

Any reason for that overhead and is there any way to speed it up?

We’re running the program and the database on an embedded device called Colibri IMx6, and the speedup would greatly help us.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Sure thing! I’m on it! @Tapac new commit has been pushed! This is an example output from my PC

h2 database creation #2 took 1402 ms
Filling database with 50 random 15 long strings took 51 ms
There's 50 text lines in the database!
Number of databases: 1
h2 database creation #1 took 381 ms
Filling database with 50 random 15 long strings took 61 ms
There's 50 text lines in the database!
Number of databases: 1
h2 database creation #3 took 37 ms
Filling database with 50 random 5 long strings took 13 ms
Filling database with strings took 22 ms

and this is the output from Colibri imx6

h2 database creation #2 took 13169 ms
Filling database with 50 random 15 long strings took 270 ms
There's 50 text lines in the database!
Number of databases: 1
h2 database creation #1 took 873 ms
Filling database with 50 random 15 long strings took 378 ms
There's 50 text lines in the database!
Number of databases: 1
h2 database creation #3 took 114 ms
Filling database with 50 random 5 long strings took 168 ms
Filling database with strings took 171 ms