empire-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Döbele <doeb...@esteam.de>
Subject re: Peformance Issue
Date Sun, 14 Jun 2015 12:22:01 GMT
Hi Nguyen,

hmm, 1-2 minutes is a long time.
But honestly this method wasn't built for returning thousands of records.

If you just want a list of Strings as in your example, then I would recommend using DBDatabase.querySimpleList(String.class,
...);
This one should be more effective.

getGetBeanList() is intended for more complex objects.

Fortunately everything in Empire-db is overridable, so you may want to optimize it yourself
for your purposes.
Just create your own class derived from DBReader and override
public <C extends Collection<T>, T> C getBeanList(C c, Class<T> t, int maxCount)

Just copy the code and modify it.
I assume that probably the call to findMatchingAccessibleConstructor() is the bottleneck.
As you know your objects you can be more efficient.

I hope this suggestion is helpful.

Regards,
Rainer


from: Nguyen, Chieu X [mailto:chieu.nguyen@verizon.com]
to: user@empire-db.apache.org
re: Peformance Issue

Hi Rainer,


I have a SQL that returns 23K records, then, I called the code below to return the data in
a List.  It consistently took around 1 - 2 minutes to finish the getBeanList call.

Is there a way in Empire-DB for me to speed up the performance?

       List<String> dataList = new LinkedList<String>();

       DBReader reader = new DBReader();
       try
       {
           org.apache.commons.lang.time.StopWatch sw = new org.apache.commons.lang.time.StopWatch();
           sw.start();

           reader.open(dbCmd, dbConn);
           dataList = reader.getBeanList(String.class);

           sw.stop();
           log.info("getDataFromTable: Getting data from table took " + sw.toString() );
       }
       catch (Exception e)
       {
           log.error("getDataFromTable: Error in running SQL " + dbCmd.getSelect(), e);
       }
       finally
       {
           reader.close();
       }


Thank you,


Chieu Nguyen

Mime
View raw message