This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Increase processing time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Increase processing time" Watch "Increase processing time" New topic

Increase processing time

Anand Karia
Ranch Hand

Joined: Sep 25, 2004
Posts: 156

Dear All!

I am using postgresql, while fetching data it takes long time in processing as it contains number of rows. Can any body tell me How can i increase the process of my query/resultset.

Love is GOD and GOD is Love.
Anand Karia
IT Concretor.......
M/s. Anand Karia Concreting IT
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41151
That seems more of a JDBC question, not a GUI question.

Well, why does the query take so long? Could an index help?

Ping & DNS - my free Android networking tools app
John Wetherbie

Joined: Apr 05, 2000
Posts: 1441
This definitely isn't a GUI question. I'd move it to a Postgres forum if we had one. As it is I'll move it to the JDBC forum.

The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Loren Rosen
Ranch Hand

Joined: Feb 12, 2003
Posts: 156
You should run EXPLAIN on the query. See the PostgreSQL docs. If you have trouble interpreting the results post them here and I'll look at them.

(But yes, most likely you'll need some sort of index to make the query faster.)
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
Originally posted by Anand Karia:
Dear All!

I am using postgresql, while fetching data it takes long time in processing as it contains number of rows.

It's difficult to say anything useful with so little information. Things could be slow because:
  • your SQL query is inefficient
  • your resultset is huge or your database is slow, and it just is going to take that long
  • your network is too slow or has a really high error rate
  • your fetch size is too small
  • your fetch size is too big and your application doesn't have enough memory; your application has to repeatedly garbage collect to scrape up enough memory to store the fetch
  • your fetch size is too big and your application has too much memory; your JVM has more memory than can be held in your computer's physical memory at one time and garbage collection is triggering swap thrash
  • your processing after you get the row is inefficient (not a JDBC issue)
  • many other possibilities

  • You need to figure out (or tell us) where the time is going; executing the query? getting the results? processing the rows?

    You may need to see if your application is spending a lot of time in garbage collection; use Google to find out how to that if you think you need to. It usually involves setting startup parameters, such as -verbose:gc

    Also, you need to understand fetch size, if you don't already. Take a look at:
    the setFetchSize() method.

    Different drivers/databases have different default values if this is not set; for Oracle, it's 10 rows, which is usually too small - the program spends all its time waiting on the network; for Postgres, I think it's still "every row in the resultset", which is sometimes too big. Some number between 100 and 5000 is often better than the defaults.
    Anand Karia
    Ranch Hand

    Joined: Sep 25, 2004
    Posts: 156

    Its not just above all. I am using jdk1.4.2. when i transfer my project into jdk1.5.0 and later my program working fine But due to number of calculations, it takes to much time for which user get irritated.

    I tried to used threads by which users can see which number is processing. But my problem is still there that it takes long time to appear report on screen.
    I agree. Here's the link:
    subject: Increase processing time
    Similar Threads
    DojoDateTime Picker problem
    How to increase the time out period of the web service call
    CMP EJB problem
    DPI improvement
    Setting fetch size for fast retrieval of data