What exactly is the size of your objects?

Is your table indexed?


There are a lot of factors that can impact performance.


What type of performance do you get if you roll your own persistence layer?



From: Fabio [mailto:pruefsum@me.com]
Sent: Sunday, February 22, 2009 2:45 AM
To: derby-user@db.apache.org
Subject: Persisting ~10**4 entities takes 100-1200 sec




I'm using Derby (latest version) in embedded mode in a Swing application. As JPA Provider, I'm using TopLink Essentials (2.1 Build b60e-fcs).


Basically, the app grabs some data from the web and stores it in the embedded database. However, the storing process takes quite a while. Here's a code snippet:



             ArrayList<Load> load_data = grabHourlyLoadForMonthAndYear(month, year);

             if (load_data.size() > 0) {

                    System.out.println(load_data.size()+" objects");


                     for (Load l : load_data)


                    long start = System.currentTimeMillis();


                    System.out.println("time: "+ ((System.currentTimeMillis()-start)/1000) + " sec"); 



grabHourlyLoadForMonthAndYear() grabs the data from the web. "em" is the EntityManager.

The entity "Load" has 5 fields (id, country, year, hourInYear, load)


A typical output looks like this:


      17856 objects

      time: 102 sec

      16128 objects

      time: 551 sec

      17856 objects

      time: 1200 sec


As you can see, the time increases drastically while the number of objects doesn't. From a usability standpoint, that's way too much time spent on waiting.


Has anyone seen similar slow downs while using Derby together with TopLink Essentials in a desktop application?


Best Regards