How to set the fetch size for a ResultSet object?

Connection con  = getConnection();
Statement stmt = con.createConnection();
ResultSet res = stmt.executeQuery("select * from table");
//res.setFetchSize(?);
while (res.next)
res.get....
}I do not know the number of rows .
How can I set the fetch size for the ResultSet object?
I try
res.last();
res.setFetchSize(res.getRow()/2);
res.beforeFirst();
while (res.next)
res.get....
}but it's so slow if there are 6000 rows.
How can I set the fetch size for the ResultSet object more effectible?
And what is the best number to set the fetch size?

The fetch size defaults to a standard number. It is unlikely that it will be any faster if you set it unless you only plan to read a small number of rows.
i.e. if you are going to read all the rows, you need to read all the rows no matter what.
Unless the system has set the fetch size to 1 changing it will not be faster.
Depending on the row length, reading in 6000 rows is going to take a long time. You could try using a cpu profiler to improve performance.
Do you really need to read everything in every row?

Similar Messages

  • How to set the stack size for alchemy application?

    Anybody know how to set the stack size for alchemy application?
    If you know, please tell me how to adjust the stack size for alchemy application?

    Hi,
    The stack size is set as public const gstackSize in the alchemy generated code.  You can see this if you build with ACHACKS_TMPS set.  The default is one megabyte.
    One way to change the stack size is to use llvm-dis to disassemble avm2-libc/lib/avm2-libc.l.bc, generating avm2-libc.l.ll, modify the constant, and then use llvm-as to recompile your modified library and overwrite the old one.  These utilities should be in your path if alchemy is set up.

  • How to change the fetch size for a one-to-many relationship

    With Toplink 10.1.3, since using scrollablecursor is a prerequisites for changing the fetchsize on a query (using the setFetchSize), I am wondering if it would be possible to change the fetchsize of the query which is associated to a one-to-many relationship.
    So, is this possible? How ?

    In TopLink 10.1.3 you can set the fetch-size on any query, it has nothing to do with using a ScrollableCursor.
    Example:
    readQuery.setFetchSize(100);
    To set the fetch size on a mapping query use,
    mapping.getSelectionQuery().setFetchSize(100);
    In 10.1.3 you can only set this in code, not currently through XML or the Mapping Workbench. In 10.1.3.1 you should be able to set the value through XML as well.

  • How to set the font size on only one object!

    I wonder how i could programmatically set the font size on only one object?
    Igor Stojčević

    Hello,
    You can use the builtin SRW.SET_FONT_SIZE
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/builtins/srw/srw_set_font_size.htm
    in the Format trigger
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/triggers/tr_format_trigger.htm
    Regards

  • How to set the paper size for scan import

    Adobe Professional 10 - How to set the import paper size to letter or A4 (for example). The only option is automatic and it scans legal size. Normally the options would appear but I have no options other than "automatic".

    Moving this discussion to the Scanning & OCR forum.

  • How to set the fetch size

    hi guys,
    i have a master detail form and i would like to set the number of rows fetched in the master table to 10.
    How can i do this?
    Thank you,
    Angelo

    Go here:
    http://radio.weblogs.com/0118231/2005/05/15.html#a545
    (assumption that you are using a newer version)
    You can also search for "fetch size" on his site (right hand link) and read other articles like how to use SQL Trace to see the results of fetch size.

  • How to set the Heap size for JAVA

    I am facing the memory out of space problem:
    Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
    Could anyone suggest me a solution to solve the problem ?
    increase the heap size ?
    anyway to increase the heap size in the program by default without additional setup?
    Thank you.

    How to determine the program must handled with increase heap size ?
    could I know any method to know whether the program is memory leaking or need large memory heap size?

  • How to change the FONT size for a TEXT object?

    Hello
    I am keeping a TEXT element to get a static text (as 'Visitor Info Form'), so i inserted TEXT from palattes, its size is Aerial 10, but i want to have its size as 24, I tried by right clicking on TEXT, then selected FONT, then choosen the 24 from drop-down list, its not working/reflecting!! but, when i change the PARAGRAPH settings, they are reflecting!
    Pls. let me know how to change size from 10 to 24?
    Thank you

    Don't specify the styleclass for the inner panelHeader.
    <af:panelHeader text="panelHeader 1" id="ph1" styleClass="CustomHelpHeader">
    <f:facet name="context"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar"/>
    <f:facet name="legend"/>
    <f:facet name="info"/>
    <af:panelHeader text="inner panelHeader" id="ph2">
    <f:facet name="context"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar"/>
    <f:facet name="legend"/>
    <f:facet name="info"/>
    </af:panelHeader>
    </af:panelHeader>
    The inner panel header does not get affected and is displayed normally.
    Thanks,
    Navaneeth

  • Hi, I am using Indesign CS6, How to set the page size in Inches.

    Hi, I am using Indesign CS6, How to set the page size in Inches.

    All fields in InDesign can be entered in any measurement system. So, if you want to make an 8"x10" document and go to File>New Document and the window looks like this:
    …you can type either 8 in or 8" into the Width field like this:
    …and when you move to the next field, it will convert the eight inches into the equivalent number in the unit of measure that it is using at the moment, like this:
    … (203.2 milimeters is the same as 8 inches). You can also enter a different measurement unit into other fields once the file is created, such as the width or height of a frame, or the position of an object in the X and Y coordinates.
    If you would rather just work in inches instead of having to type the inches mark or abbreviation, go to InDesign>Preferences>General and select the Units & Increments tab. There you will see Ruler Units for Horizontal and Vertical at the top of the window. Set them to Inches and all of the fields will display in inches. If you do that to an open document, you will change the unit of measure for that document. If you do it while no documents are open, it will change the unit of measure for any new documents you create. To change the unit of measure for existing documents, you will have to open each and make the change.

  • How to set the screen size with nested Iview screen

    Can someone show me how to set the screen size with nested IView  screen.
    at the moment i only try it with trial and error untill it looks somewhat close. Is there a property in VC to set the size for Height and width.
    The same question is for the form. the form elements inside the form is easy but the actual form is still a challenge.

    Hi,
    Yes you are correct ,Still the Form and iview are not able to change thier Layout Structure using a Propery.
    it is available with VC7.1
    Govindu

  • How to set the frame size?

    Hi,
    Can some one show me how to set the frame size in this program? History: I have created a window and added a button but its to small. So I want to increase the size of the frame to at least 600X400 pixel.
    private static void showGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("ButtonDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            Main newContentPane = new Main();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        }It would be nice if you could show me how to do it.
    Thank you very much for reading this.

    Challenger wrote:
    Simply adding
    frame.setSize(new Dimension(600,400));to the end of your code should work perfectly.Or, if you want to do it correctly, .setPreferredSize() on your frame before you .pack() it. The default layout manager for JFrame is BorderLayout, which uses the preferredSize of each component to calculate sizes during the .pack() call.

  • How to set the heap size of JVM

    please let me know that how to set the heap size of JVM

    C:\>java -X
        -Xmixed           mixed mode execution (default)
        -Xint             interpreted mode execution only
        -Xbootclasspath:<directories and zip/jar files separated by ;>
                          set search path for bootstrap classes and resources
        -Xbootclasspath/a:<directories and zip/jar files separated by ;>
                          append to end of bootstrap class path
        -Xbootclasspath/p:<directories and zip/jar files separated by ;>
                          prepend in front of bootstrap class path
        -Xnoclassgc       disable class garbage collection
        -Xincgc           enable incremental garbage collection
        -Xbatch           disable background compilation
        -Xms<size>        set initial Java heap size
        -Xmx<size>        set maximum Java heap size
        -Xss<size>        set java thread stack size
        -Xprof            output cpu profiling data
        -Xrunhprof[:help]|[:<option>=<value>, ...]
                          perform JVMPI heap, cpu, or monitor profiling
        -Xdebug           enable remote debugging
        -Xfuture          enable strictest checks, anticipating future default
        -Xrs              reduce use of OS signals by Java/VM (see documentation)look at the -Xm? lines
        -Xms<size>        set initial Java heap size
        -Xmx<size>        set maximum Java heap sizeThis can be used e.g. like this:java -Xms8M -Xmx32M MyProgwhich runs MyProg in a java VM with the initial heap size of 8 MB and a maximum heap size of 32 MB.
    - Marcus

  • How to set the fix size jframe window

    when I run the jframe ,the jframe window size is very small
    1)how to set the fix size jframe window??
    2)how to set the jframe cannot change the window size??
    thx~~

    1. You can set the size by calling JFrame's method setSize. There are two versions of this method: (1) setSize(int width, int height) and (2) setSize(Dimension d). Note, that when you use this method to set the frame size, you don't have to call JFrame's pack method.
    2. JFrame has a method called setResizable(boolean resizable) which you can call with the argument false.
    Without any ill intent, these questions are regarding something that is very easily answered by looking at the documentation for the JFrame class. I suggest to anyone working with swing to at least look briefly through the base classes they're extending before giving up. In my experience it is always more gratifying to figure things out on my own than asking someone. But please don't take this the wrong way, I respect people who seek out help in order to further their knowledge, instead of just giving up.

  • How to set the heap size in adminstrative console

    Hi All,
    Please let me know how to increase heap size in weblogic Adminstrative console.
    Regards
    Madhu

    The answer to this depends on whether you're trying to set the heap size for a manager server which is managed by NodeManager, or the admin server.
    First click on "Lock and Edit".
    If the former, go into "Environment"->"Servers", then click on the server you want to configure. This should start you on the "Configuration"->"General" tab. Now click on the "Server Start" tab. Find the "Arguments" field. Assuming this is blank, put something like the following in the field value:
    -Xmx1536m
    Then click "Save", then "Activate Changes". When you restart the managed server the next time, it should use those new settings.
    If, however, you're trying to set this on the admin server, you can't do this in the admin console at all. In that case, go into $DOMAIN_HOME/bin and edit the "setDomainEnv.{sh,cmd}" script (".sh" if on Unix/Linux, ".cmd" on Windows). Find the line that sets the "MEM_ARGS" variable, like the following on Windows:
    set MEM_ARGS=-Xms256m -Xmx512m
    Change this line to whatever you want, then restart the admin server.

  • SRM 4.0- How to set the default values for product type (01) only for SC

    The radio button “Service” should not be visible.
    Also for search help (e.g. search for internal products) where a search should only be possible for product type 01 (goods). The system should not display the product type and internally always search for goods only.
    How to set the default values for product type (01) only for SC
    We needs to use Search help BBPH_PRODUCT which having parameter PRODUCT_TYPE
    Here we can set defalut value 01 but it is not correct one since same search help is using several places.
    We need to limit the search help results only for SC.
    Kindly help out me ASAP.

    The easiest way to set defautl values is to edit the batch class.
    Goto the characteiristic and go to update values.
    In here you probably have something like 0 - 100 as a spec range.
    On the next line enter the default value within this range.  At the end of the line, click in the box in the column labelled "D".  This indicates the defautl value for the characteristic.
    If you need to you can do this in the material classification view as well.
    Just to be clear, these values will only show up in the batch record.  You can not have defautl values in resutls recording screens.
    FF

Maybe you are looking for