+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

query taking long time from java code

  1. query taking long time from java code

    We have a struts based UI. Database is oracle 9i. Few queries are
    taking around 5-15 seconds to execute from TOAD. But the same query
    from java code (using prepared statement) takes around 3 mins... We
    have used hint as CHOOSE in both (Toad and Java).

    Any pointers please?
    Thanks.


  2. Re: query taking long time from java code

    This is because TOAD gives out the first rows as soon as they are
    fetched. Your query in TOAD takes as long as in java, if you wait for
    all result rows.

    Do a

    select count(*) from (

    );

    in TOAD. Here, oracle must wait until all rows are fetched to calcucate
    the count.

    I think you have to implement paging in your java app. Pages that show
    lines 1-20, 21-40,... and so on. In your java code, you should do
    something like:

    select * from (

    ) where rownum <= 20;


  3. Re: query taking long time from java code

    This is because TOAD gives out the first rows as soon as they are
    fetched. Your query in TOAD takes as long as in java, if you wait for
    all result rows.

    Do a

    select count(*) from (

    );

    in TOAD. Here, oracle must wait until all rows are fetched to calcucate
    the count.

    I think you have to implement paging in your java app. Pages that show
    lines 1-20, 21-40,... and so on. In your java code, you should do
    something like:

    select * from (

    ) where rownum <= 20;


  4. Re: query taking long time from java code

    This is because TOAD gives out the first rows as soon as they are
    fetched. Your query in TOAD takes as long as in java, if you wait for
    all result rows.

    Do a

    select count(*) from (

    );

    in TOAD. Here, oracle must wait until all rows are fetched to calcucate
    the count.

    I think you have to implement paging in your java app. Pages that show
    lines 1-20, 21-40,... and so on. In your java code, you should do
    something like:

    select * from (

    ) where rownum <= 20;


  5. Re: query taking long time from java code

    Hi,
    Thanks for the reply. I will try this out. However I am not using
    pagination. I am trying to get a product list from database which has
    got 15+ million records. And the number of rows returned from the
    search are only 5-10...
    Thanks,
    Palak.

    NitelyJoy wrote:

    > This is because TOAD gives out the first rows as soon as they are
    > fetched. Your query in TOAD takes as long as in java, if you wait for
    > all result rows.
    >
    > Do a
    >
    > select count(*) from (
    >
    > );
    >
    > in TOAD. Here, oracle must wait until all rows are fetched to calcucate
    > the count.
    >
    > I think you have to implement paging in your java app. Pages that show
    > lines 1-20, 21-40,... and so on. In your java code, you should do
    > something like:
    >
    > select * from (
    >
    > ) where rownum <= 20;



  6. Re: query taking long time from java code

    Hi,
    Thanks for the reply. I will try this out. However I am not using
    pagination. I am trying to get a product list from database which has
    got 15+ million records. And the number of rows returned from the
    search are only 5-10...
    Thanks,
    Palak.

    NitelyJoy wrote:

    > This is because TOAD gives out the first rows as soon as they are
    > fetched. Your query in TOAD takes as long as in java, if you wait for
    > all result rows.
    >
    > Do a
    >
    > select count(*) from (
    >
    > );
    >
    > in TOAD. Here, oracle must wait until all rows are fetched to calcucate
    > the count.
    >
    > I think you have to implement paging in your java app. Pages that show
    > lines 1-20, 21-40,... and so on. In your java code, you should do
    > something like:
    >
    > select * from (
    >
    > ) where rownum <= 20;



  7. Re: query taking long time from java code

    Hi,
    Thanks for the reply. I will try this out. However I am not using
    pagination. I am trying to get a product list from database which has
    got 15+ million records. And the number of rows returned from the
    search are only 5-10...
    Thanks,
    Palak.

    NitelyJoy wrote:

    > This is because TOAD gives out the first rows as soon as they are
    > fetched. Your query in TOAD takes as long as in java, if you wait for
    > all result rows.
    >
    > Do a
    >
    > select count(*) from (
    >
    > );
    >
    > in TOAD. Here, oracle must wait until all rows are fetched to calcucate
    > the count.
    >
    > I think you have to implement paging in your java app. Pages that show
    > lines 1-20, 21-40,... and so on. In your java code, you should do
    > something like:
    >
    > select * from (
    >
    > ) where rownum <= 20;



  8. Re: query taking long time from java code

    perhaps posting the relevant section of your java code might help us.

    --

    Niall Litchfield
    Oracle DBA
    http://www.orawin.info/services/

  9. Re: query taking long time from java code

    perhaps posting the relevant section of your java code might help us.

    --

    Niall Litchfield
    Oracle DBA
    http://www.orawin.info/services/

  10. Re: query taking long time from java code

    perhaps posting the relevant section of your java code might help us.

    --

    Niall Litchfield
    Oracle DBA
    http://www.orawin.info/services/

+ Reply to Thread
Page 1 of 2 1 2 LastLast