Retrieving a part of big result set at a time

I will try to present a simplistic view of the problem at hand. I
want to display large volume of data on a web page. We are
interested in displaying 50 records and a time and want to
control it at the database level. I am looking at some option to
pass the database the information that I need 1-50 records from
the selected records (then 51-100 and so on).
I want to keep it as simple as possible and came up with this script:
select myrow, col1
     from (Select rownum myrow, col1 from mytable)
     where myrow > 0 and myrow < 51;
where mytable is a table with a column col1.
For the sake of simplicity I have removed other where clauses.
This options works but the data is not ordered. I want to
retrieve the data in ordered fashion and then retrieve first 50
and so on. I want to do something like:
select myrow, col1
     from (Select rownum myrow, col1
from mk
order by col1)
     where myrow > 2 and myrow < 4;
but Oracle does not let me put order by with the nested select.
Does anyone have a suggestion to resolve this issue? It could be
a totally different solution as long as it is straight forward.
Using a cursor or temp tables is not practical since it won't
meet our performance parameters.
Any suggestions ???
TIA

select tp2.col1, tp2.myrow
from (select rownum myrow, tp1.col1
from (Select col1
from mytable
order by col1) tp1
) tp2
where tp2.myrow > 0 and tp2.myrow < 51;

Similar Messages

  • Retrieving Part of a Result Set

    I am looking for the syntax to retrieve results back from the database in small blocks. Actually this is very similar to the way that this discussion forums bring back a fixed number of topics and has the page links to get the next list of topics. The only way that I can come up with to query the chunks that I need is to use a two identical queries, and then using a MINUS with rownum for narrowing down the final select statement. The problem with this is that the query takes a very long time to execute using this method. I assume that there must be a better way of doing this, as most discussion boards return quickly when moving to different pages of topics.

    You are using JDBC so you have an open "implicit cursor" ( resultset ) for your query.
    you can open an entier resultset and use a counter and the method .next to delimit the number of records you want to see..

  • PHP and result sets: size and time

    Hi
    I'm tasked with debugging and "fixing" a PHP application which (someone else developed) is running slowly and "timing out", now that data is in there. I set about inserting some brief timing "debug" stuff within the code to attempt to determine where the rate limiting steps were happening. I found two areas in the code which were quite slow:
    1) Query of the oracle database via a package, declaration of the procedure is:
    procedure findAllSorted(sortMode in string, resultSet IN OUT types.cursortype);
    2) looping on this and filling the array into objects
              while ($res = $result->FetchRow()) {
                   // don't use $array[] = $this->load($res);, it throws an error
                   $array[] = $this->doLoad($res);
    My method timed the execution of both these steps:
    1) Execution for oracle is:11.60035777092 Seconds
    2) Execution for loop is:17.87319111824 Seconds
    the amount of data that is returned by the fiindAllSorted() procedure is not what I'd call high, although that is part of my question here ... how much is a lot?
    When I execute the procedure in PL/SQL Developer (and get all rows, not just the first 10) there are 1600 rows returned. When saved as a CSV file its about 260K of data ... I would not have thought this was problematic.
    the other part of my question is (assuming people don't say "holy cow you're returning one thousand six hundred rows") how can I speed this part of the step up?

    What values of oci8.default_prefetch or oci_set_prefetch() have you tried? See the discussion on p149 of The Underground PHP and Oracle Manual. I wonder if you are still using OCI8 1.2 with the lower default value.
    Pre-fetching from REF CURSORS was first supported with Oracle 11gR2. You only need 11gR2 client libraries - pre-fetching from basic REF CURSORS will work when connected to older DB versions. See my blog post about Oracle Database 11gR2 Enhancements for PHP. New client libraries are available free from OTN. If you can't upgrade your Oracle Client libraries then perhaps you can refactor findAllSorted() and use pipelining. This is discussed on p172 of The Underground PHP and Oracle Manual.
    Make sure your queries only select the columns you need.
    Rasmus Lerdorf's recent talk http://talks.php.net/show/digg has some good overall PHP analysis and tuning tips.
    To finish up, here is output from repeating a query with different prefetch values:
    Time to fetch 1600 rows. Prefetch is 500 : Fetch time is: 0.085 seconds
    Time to fetch 1600 rows. Prefetch is 100 : Fetch time is: 0.090 seconds
    Time to fetch 1600 rows. Prefetch is  10 : Fetch time is: 0.144 seconds
    Time to fetch 1600 rows. Prefetch is   0 : Fetch time is: 0.508 seconds

  • Eliminating null from result set

    Hi,
    How can i set some value (say 0) for fields having null value using ejbql?
    Anybody please help me....
    Thanks in Advance,
    Anish.

    what is the best way to get from a jdbc Result Set to
    a Swing Table Model?I think I would iterate over all the elements in my result set and add them to a hashmap / hashtable where the key is their spot in the table, represented by a Point object. One thing I'm not sure of is if 2 points with equal coordinates have the same hash value, but you could always just create your own point class where such is the case and use that.
    Result Sets are no random access structures. You have
    to navigate through them to reach a certain row.Yes. Not only that, but the resultset is part of your transaction with the DB. It's not good style to keep that open any longer than necessary.
    JTable Models want you to implement something like
    getValueAt(int i, int j) to access a row (and even a
    column) at random.Would be easy using my suggestion above
    - your are in fact interducing another cashKind of. But you don't have a choice. You gotta copy the data.
    - big Result Sets could be a problemThat's always going to be true, and I don't see how you can get around it.

  • SCROLL_SENSITIVE result set can't see the data inserted.

    hi all ,
    I am trying to display all the latest data available in the table through SCROLL_SENSITIVE and UPDATABLE result set after inserting a new record in the table.
    But the result set obtained after executing the query initially is not able to see the newly inserted record in the table and hence same result is getting printed out in both the cases.
    Can u explain me what's happening in this case ?? And how can i get the updated record also without executing the statement query twice to get the latest result set.
    My full code is given below.
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class Misc3 {
    public static void main(String[] args) {
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
    int empid;
    String lname;
    String fname;
    int deptno;
    int mngrid;
    con = JDBCUtil.getOracleConnection();
    stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    String query = "select employee_id , last_name , first_name , department_number , manager_id from employees ";
    rs = stmt.executeQuery(query);
    System.out.println("Before inserting the new record.....");
    while (rs.next()) {
    empid = rs.getInt(1);
    lname = rs.getString(2);
    fname = rs.getString(3);
    deptno = rs.getInt(4);
    mngrid = rs.getInt(5);
    System.out.println(empid + "\t" + lname + "\t" + fname + "\t" + deptno + "\t" + mngrid);
    System.out.println("Going to insert the new record.....");
    rs.moveToInsertRow();
    rs.updateInt(1, 10);
    rs.updateString(2, "Clark");
    rs.updateString(3, "John");
    rs.updateInt(4, 2);
    rs.updateInt(5, 2);
    rs.insertRow();
    System.out.println("New record inserted successfully.....");
    System.out.println("After inserting the new record.....");
    rs.beforeFirst();
    while (rs.next()) {
    empid = rs.getInt(1);
    lname = rs.getString(2);
    fname = rs.getString(3);
    deptno = rs.getInt(4);
    mngrid = rs.getInt(5);
    System.out.println(empid + "\t" + lname + "\t" + fname + "\t" + deptno + "\t" + mngrid);
    } catch (SQLException ex) {
    System.out.println("error code : " + ex.getErrorCode());
    System.out.println("error message : " + ex.getMessage());
    } finally {
    JDBCUtil.cleanUp(con, stmt);
    *** JDBCUtil Class ****
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class JDBCUtil {
    public static Connection getOracleConnection(){
    Connection con = null;
    try{
    // Load the driver
    Class.forName("oracle.jdbc.driver.OracleDriver");
    //Establish Connection
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","ex","ex");
    }catch(Exception ex){
    ex.printStackTrace();
    return con;
    public static void cleanUp (Connection con , Statement stmt){
    // Release the resource
    try{
    if(con != null){
    con.close();
    if(stmt != null){
    stmt.close();
    }catch(Exception ex){
    ex.printStackTrace();
    Edited by: user12848632 on Aug 13, 2012 2:06 PM

    >
    Can u explain me what's happening in this case ?? And how can i get the updated record also without executing the statement query twice to get the latest result set.
    >
    Sure - but you could have answered your own question if you had read the doc link I gave you in your other thread and next time you post code use \ tags on the lines before and after the code - see the FAQ for info
    17076 : Invalid operation for read only resultset
    {quote}
    •Internal INSERT operations are never visible, regardless of the result set type.
    {quote}
    See •Seeing Database Changes Made Internally and Externally in the JDBC Dev doc I pointed you to
    http://docs.oracle.com/cd/B28359_01/java.111/b31224/resltset.htm#i1024720
    Did you notice the words 'never visible'? You won't see them as part of the result set unless you requery.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Create tabs from database retrieval result set?

    Trying to figure out how to dynamically create tabs based on a database result set....
    for example when page launches, a db connection starts, and a query is made to retrieve say, distinct colors available in a db table, and a tab page is generated for each color found... is there a way to do this?
    Thanks for any advice or assistance. Example would be big help.

    Thanks for the link, I think I'd read that before, but wasn't too sure how I could adapt it to create tabs... not sure where to find the method references to the tabset or tab components to call... any tips or examples would be useful. Thanks!

  • Query Error Information: Result set is too large; data retrieval ......

    Hi Experts,
    I got one problem with my query information. when Im executing my report and drill my info in my navigation panel, Instead of a table with values the message "Result set is too large; data retrieval restricted by configuration" appears. I already applied "Note 1127156 - Safety belt: Result set is too large". I imported Support Package 13 for SAP NetWeaver 7. 0 BI Java (BIIBC13_0.SCA / BIBASES13_0.SCA / BIWEBAPP13_0.SCA) and executed the program SAP_RSADMIN_MAINTAIN (in transaction SE38), with the object and the value like Note 1127156 says... but the problem still appears....
    what Should I be missing ??????  How can I fix this issue ????
    Thank you very much for helping me out..... (Any help would be rewarded)
    David Corté

    You may ask your basis guy to increase ESM buffer (rsdb/esm/buffersize_kb). Did you check the systems memory?
    Did you try to check the error dump using ST22 - Runtime error analysis?
    Edited by: ashok saha on Feb 27, 2008 10:27 PM

  • WAD : Result set is too large; data retrieval restricted by configuration

    Hi All,
    When trying to execute the web template by giving less restiction we are getting the below error :
    Result set is too large; data retrieval restricted by configuration
    Result set too large (758992 cells); data retrieval restricted by configuration (maximum = 500000 cells)
    But when we try to increase the number of restictions it is giving output. For example if we give fiscal period, company code ann Brand we are able to get output. But if we give fical period alone it it throwing the above error.
    Note : We are in SP18.
    Whether do we need to change some setting in configuration? If we yes where do we need to change or what else we need to do to remove this error
    Regards
    Karthik

    Hi Karthik,
    the standard setting for web templates is to display a maximum amount of 50.000 cells. The less you restrict your query the more data will be displayed in the report. If you want to display more than 50.000 cells the template will not be executed correctly.
    In general it is advisable to restrict the query as much as possible. The more data you display the worse your performance will be. If you have to display more data and you execute the query from query designer or if you use the standard template you can individually set the maximum amount of cells. This is described over  [here|Re: Bex Web 7.0 cells overflow].
    However I do not know if (and how) you can set the maximum amount of cells differently as a default setting for your template. This should be possible somehow I think, if you find a solution for this please let us know.
    Brgds,
    Marcel

  • Result set is too large; data retrieval restricted by configuration

    Hi,
    While executing query for a given period, 'Result set is too large; data retrieval restricted by configuration' message is getting displayed. I had searched in SDN and I had referred the following link:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/d047e1a1-ad5d-2c10-5cb1-f4ff99fc63c4&overridelayout=true
    Steps followed:
    1) Transaction Code SE38
    2) In the program field, entered the report name SAP_RSADMIN_MAINTAIN and Executed.
    3) For OBJECT, entered the following parameters: BICS_DA_RESULT_SET_LIMIT_MAX
    4) For VALUE, entered the value for the size of the result set, and then executed the program:
    After the said steps, the below message is displayed:
    OLD SETTING:
    OBJECT =                                VALUE =
    UPDATE failed because there is no record
    OBJECT = BICS_DA_RESULT_SET_LIMIT_MAX
    Similar message is displayed for Object: BICS_DA_RESULT_SET_LIMIT_DEF.
    Please let me know as to how to proceed on this.
    Thanks in advance.

    Thanks for the reply!
    The objects are not available in the RSADMIN table.

  • Result Set Too Large : Data Retrieval restricted by configuration

    Hi Guys,
    I get the above error when running a large dataset, with a hierarchy on - but when I run without a hierarchy I am able to show all data.
    The Basis guys increased the ESM buffer (rsdb/esm/buffersize_kb) but it still causes an issue.
    Anyone any ideas when it comes to reporting large volumes with a hierarchy?
    Much appreciated,
    Scott

    Hi there
    I logged a message on service marketplace andg got this reply from SAP:
    ' You might have to increase the value for parameters
    BICS_DA_RESULT_SET_LIMIT_DEF and BICS_DA_RESULT_SET_LIMIT_MAX as it
    seems that the result set is still too large. Please check your
    parameters as to how many data cells you should expect and set the
    parameter accordingly.
    The cells are the number of data points that would be send from abap
    to java. The zero suppression or parts of the result suppression are
    done afterwards. As a consequence of this, the number of displayed
    data cells might differ from the threshold that is effective.
    Starting with SPS 14 you get the information how many data cells are
    rejected. That gives you better ways to determine the right setting.
    Currently you need to raise the number to e.g. 2.000.000 to get all
    data.
    If BICS_DA_RESULT_SET_LIMIT_MAX is set to a lower value than
    BICS_DA_RESULT_SET_LIMIT_DEF, it would automatically cut the value of
    BICS_DA_RESULT_SET_LIMIT_DEF down to its own..
    Please note that altough this parameter can be increased via
    configuration, you should do a proper system sizing according to note
    927530 to ensure that the system can handle the number of users and
    resultset sizes you are expecting."
    Our basis team have subsequently apllied these changes, and I will be testing today.
    Thx

  • Query - Cannot Retrieve the Data / Result Set

    Hello,
    I'm trying to query a cube through the OLAP connection using Java and every time I try to execute a query an exception is thrown stating "Cannot retrieve the data set" or "Cannot retrieve the result set" depending on how I'm doing the query.  I've tried to execute the query both through the use of an IBIQuery and IBICommandProcessor object as well as directly through the IBIOlap connection via an MDX statement and both methods produce the same exception.  If anyone can shed some light on why exception is being thrown it would be greatly appreciated.

    please help me ... The question has nothing to do with 'getting' data from excel and certainly not with putting it into MySQL.
    The stack trace specifically tells you that your connection string is wrong.
    It also tells you which connection string is wrong.
    Which you can use to determine specifically which one is wrong. And which you did not provide that info to us.

  • Can I retrieve a result set from Oracle and then incorporate that result set into my main SQL Server Stored Procedure?

    So I have a chunk of data that only resides in Oracle. So I need to capture that information from Oracle. Now before you get over zealous, I did try with an OPENQUERY and it took FOREVER! And I don't know why the OPENQUERY took FOREVER but if I run the same
    query directly against Oracle it runs very quickly...like 20 seconds.
    So now I'm wondering...can I build a dataset in my SSRS Report that uses an Oracle Data source and an Oracle Stored Procedure in its Dataset that I'll create to aggregate this subset of data and then utilize its result set back in my main reporting
    Dataset that will utilize SQL Server? And how can I do that? Can I make my main Dataset reference, say, a #TemporaryTable that is created from my Oracle Dataset in its
    I'll continue to Google a few things as I await your review and hopefully a reply.
    Thanks in advance for your help.

    Hi ITBobbyP,
    According to your description you want to use data from a Oracle data source into a DataSet which retrieving data from SQL Server. Right?
    In Reporting Services, we can have multiple data sources in one project pointing to different database. And we can use separated dataset to retrieve data from different data source. However, it's not supported to combine the two datasets together
    directly. We can only use Lookup(), LookupSet() function to combine fields from different dataset into one tablix when there are common columns between two datasets. This is the only way to make tow result sets together in SSRS.
    Reference:
    Lookup Function (Report Builder and SSRS)
    LookupSet Function (Report Builder and SSRS)
    Best Regards, 
    Simon Hou
    TechNet Community Support

  • Error while retrieving result set in JTFGRID.

    Hi ,
    We have developed a custom form where there are various search parameters. Contract Number being one of them. The result set consists of various fields like Contract ID, Contract Number, Contract Number modifier etc.  This result is deriving its data from a custom view based on the contract id of the contract selected and populating in the grid.
    The issue is the result set is coming only for few contracts and for some it is throwing the below error:
    APP-JTF- 210604: Program Error: Please inform your system admin or support representative that:
    jtf_grid.populate package reports error :
    An unexpected error occurred  in jtf_grid.populate
    grid :<customgridname>
    datasource:<customdatasource>
    The following information is available
    <null>
    The error is most likely in the form or the metadata definition . Please check the following alert for the error code.
    The error stack is (first 1000 bytes):
    ORA-01722: invalid number
    ORA-06512: at "APPS.JTF_GRIDDB" , line 837
    ORA-06512: at "APP.JTF_GRIDDB" , line 878
    The datatype of the contract id of all the contracts is same. Not sure what the issue is.
    Please provide your inputs on the above. If this is not the correct forum for this query then please let me know the correct one.
    Thanks a lot,
    Ishani

    Bhuvan12 wrote:
    suggest me any best practices to create large Excel files.Best practice is to revisit the requirement that suggest an excel file is a solution in the first place. Excel is for humans. Humans don't do well consuming large amounts of data. So either create a machine readable format or create a summerized format for humans.

  • JDBC-ODBC Bridge to SPSS data files - Result Set Type is not supported

    Hello,
    As mentioned in the subject I am trying to read SPSS data files using the SPSS 32-Bit data driver, ODBC and the JDBC-ODBC Bridge.
    Using this SPSS Driver I manged to read the data directly into an MS-SQL Server using:
    SELECT [...] FROM
    OPENROWSET(''MSDASQL.1'',''DRIVER={SPSS 32-BIT Data Driver (*.sav)};DBQ=' SomePathWhereTheFilesAre';SERVER=NotTheServer'', ''SELECT 'SomeSPSSColumn' FROM "'SomeSPSSFileNameWithoutExt'"'') AS a
    This works fine!
    Using Access and an ODBC System DNS works for IMPORTING but NOT for LINKING.
    It is even possible to read the data using the very slow SPSS API.
    However, when it comes to JDBC-ODBC the below code does only work in part. The driver is loaded successfully, but when it comes to transferring data into the resultset object the error
    SQLState: null
    Result Set Type is not supported
    Vendor: 0
    occurs.
    The official answer from SPSS is to use .Net or to use their implementation with Python in their new version 14.0. But this is obviously not an option when you want to use only Java.
    Does anybody have experience with SPSS and JDBC-ODBC??? I have tried the possible ResultSet Types, which I took from:
    http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/rjvdsprp.htm
    and none of them worked.
    Thank you in advance for your ideas and input & stay happy!
    Here the code without all the rest of the class arround it:
    // Module:  SimpleSelect.java
    // Description: Test program for ODBC API interface.  This java application
    // will connect to a JDBC driver, issue a select statement
    // and display all result columns and rows
    // Product: JDBC to ODBC Bridge
    // Author:  Karl Moss
    // Date:  February, 1996
    // Copyright: 1990-1996 INTERSOLV, Inc.
    // This software contains confidential and proprietary
    // information of INTERSOLV, Inc.
    public static void main1() {
      String url   = "jdbc:odbc:SomeSystemDNS";
      String query = "SELECT SomeSPSSColumn FROM 'SomeSPSSFileName'";
      try {
        // Load the jdbc-odbc bridge driver
        Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
        DriverManager.setLogStream(System.out);
        // Attempt to connect to a driver.  Each one
        // of the registered drivers will be loaded until
        // one is found that can process this URL
        Connection con = DriverManager.getConnection (url);
        // If we were unable to connect, an exception
        // would have been thrown.  So, if we get here,
        // we are successfully connected to the URL
        // Check for, and display and warnings generated
        // by the connect.
        checkForWarning (con.getWarnings ());
        // Get the DatabaseMetaData object and display
        // some information about the connection
        DatabaseMetaData dma = con.getMetaData ();
        System.out.println("\nConnected to " + dma.getURL());
        System.out.println("Driver       " +
          dma.getDriverName());
        System.out.println("Version      " +
          dma.getDriverVersion());
        System.out.println("");
        // Create a Statement object so we can submit
        // SQL statements to the driver
        Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY ,ResultSet.CONCUR_READ_ONLY);
        // Submit a query, creating a ResultSet object
        ResultSet rs = stmt.executeQuery (query);
        // Display all columns and rows from the result set
        dispResultSet (rs);
        // Close the result set
        rs.close();
        // Close the statement
        stmt.close();
        // Close the connection
        con.close();
      }

    Thank you for your reply StuDerby!
    Actually the above script was before, as you suggested, leaving the ResultSetTeype default. This did not work...
    I am getting gray hair with SPSS - in terms of connectivity and "integratebility" none of their solutions offered is sufficient from my point of view.
    Variable definitions can only be read by the slow API, data can only be read by Python or Microsoft Products... and if you want to combine both you are in big trouble. I can only assume that this is a company strategy to sell their Dimensions Platform to companies versus having companies developping their applications according to business needs.
    Thanks again for any furthur suggestions and I hope, that some SPSS Developper will see this post!
    Cheers!!

  • Result Set fetch agonisingly slow

    I am having sporadic trouble retrieving data from a ResultSet. I do not know how to tell if it is an Oracle problem or a JDBC problem.
    In a while( results.next() ) loop, for some result sets it pauses for several seconds after every 10 iterations. This usually causes a webserver time-out and the results never get to the browser. It is NOT volume related, as some LARGER result sets from almost identical queries (i.e. with just one value in the where clause changed) run fine. We are using Oracle 8i, and the "problem" query always runs fine in SQLPlus (i.e. less than ten seconds for the execution and display of ~700 rows).
    some relevant evidence:
    a) Usually the PreparedStatement.execute() itself is pretty quick - just a few seconds at worst
    b) All result sets from this query pause every 10 iterations, but most pause for just a fraction of a second
    c) With a certain value in the where clause, the pauses are 4-30 seconds, which, even when only ~700 rows are returned, results in a response time of several minutes.
    d) The pauses are in the results.next() statement itself (I have output timestamps at the very beginning and the very end of the loop to show this).
    e) the query is a join of six tables
    f) the part of the where clause that changes is: AND FULFILLER.NAME IN (...) , where the IN clause can contain single or multiple names (but I am using a single value in the "problem" query)
    g) The FULFILLER.NAME column IS an indexed field, and that index IS being used (according to "EXPLAIN PLAN") in both the fast queries and the slow queries.
    What confuses me (amongst several things) is this: I would have thought that the values in the where clause would only affect the creation of the ResultSet, and not the reading of that result set. Am I wrong? Any ideas anyone?
    Thanks,
    Martin Reynolds (renozu)

    I am having sporadic trouble retrieving data from a
    ResultSet. I do not know how to tell if it is an
    Oracle problem or a JDBC problem.
    In a while( results.next() ) loop, for some
    result sets it pauses for several seconds after every
    10 iterations. This usually causes a webserver
    time-out and the results never get to the browser. It
    is NOT volume related, as some LARGER result sets from
    almost identical queries (i.e. with just one value in
    the where clause changed) run fine. We are using
    Oracle 8i, and the "problem" query always runs fine in
    SQLPlus (i.e. less than ten seconds for the execution
    and display of ~700 rows).
    some relevant evidence:
    a) Usually the PreparedStatement.execute() itself is
    pretty quick - just a few seconds at worst
    b) All result sets from this query pause every
    10 iterations, but most pause for just a fraction of a
    second
    c) With a certain value in the where clause, the
    pauses are 4-30 seconds, which, even when only ~700
    rows are returned, results in a response time of
    several minutes.
    d) The pauses are in the results.next() statement
    itself (I have output timestamps at the very beginning
    and the very end of the loop to show this).
    e) the query is a join of six tables
    f) the part of the where clause that changes is:
    AND FULFILLER.NAME IN (...) , where the IN
    clause can contain single or multiple names (but I am
    using a single value in the "problem" query)
    g) The FULFILLER.NAME column IS an indexed field, and
    that index IS being used (according to "EXPLAIN PLAN")
    in both the fast queries and the slow queries.
    What confuses me (amongst several things) is this: I
    would have thought that the values in the where clause
    would only affect the creation of the
    ResultSet, and not the reading of that result
    set. Am I wrong? Any ideas anyone?
    this honestly doesn't HAVE to be the case... depending on the cursor.
    i think if one has a forward only cursor the database could figure it out as it scans along the table. it should be fater in fact because if it does like this you only do one table scan and not two. this theory seems to fall apart when you say it is using the index BUT if I was writing a database and you had a forward only cursor AND the distribution of keys in the index indicated that there were many rows that would match your query I might ignore the index and do it as described.
    so call me crazy but here is my suggestion...
    if the cursor you are using is a forward only cursor then try a scrollable cursor.
    if it is already a scrollable cursor or changing it didn't help then try this...
    rs.last();
    rs.beforeFirst();
    // now process normally using next()i would think that this would force the database to find all the rows.... so it should help.
    also the server timeout issue will sort of need to be addressed also if the query still takes a long time to run...
    Thanks,
    Martin Reynolds (renozu)

Maybe you are looking for

  • Cisco ASA 5505: How to change the default OS

    Hello, I'm learning how to work on the Cisco ASA 5505. My machine has two OS images: the old 7. whatever image and a more recent 8.2 image. The 8.2 image is lower in the index on disk0 so whenever I reboot the machine, the start up points it towards

  • Video out from MacBook Pro to HDTV - no solution?

    I've had this problem for over a year now and nobody has been able to help me solve it, not even the Apple guys. I need to get the video out from my MacBook Pro (Mini DisplayPort) to my HDTV which is an older model which only has Y/Pb/Pr analogue vid

  • How to make my applet run in eclipse browser..?

    I wrote an applet and it works fine when it is run as an applet in eclipse galileo.I need to embed it in a web page.I have searched this forum but unable to find adequate information.It is also not reporting any errors.Html file looks as below <html>

  • Ignore certain callers automatically

    Does anyone now if it's possible to set up a ring profile so if certain contacts call then the phone will ring, but if anyone else calls the phone will send the caller to directly to voicemail? I've had a few phones with this capability and it's quit

  • Mail App won't let me reply/reply all to messages

    Hi folks, Unfortunalty, I have a problem on my hands. My Mail application won't let me "Reply" or "Reply all" to certain messages. I noticed so far that I cannot reply to messages from the GMail domain. If I click on "Reply" or "Reply All", the butto