• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Increase processing time

 
Ranch Hand
Posts: 158
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That seems more of a JDBC question, not a GUI question.

Well, why does the query take so long? Could an index help?
 
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.)
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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:
    http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.htm
    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
    Posts: 158
    Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic