Re: Big selects on PostGres : Configuring Statement.setFetchSize() of a selectquery

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Thu May 21 2009 - 08:59:27 EDT

  • Next message: Andrus Adamchik: "Re: Big selects on PostGres : Configuring Statement.setFetchSize() of a selectquery"

    Now when I know of this JDBC feature, I'd prefer to have it in Cayenne
    sooner that later. We would also want to have it for other queries than just
    only SelectQuery. Could someone help me testing it against different types
    of database if I commit?

    2009/5/20 stefcl <stefatwor..mail.com>

    >
    > I have posted a small fix in the jira.
    >
    >
    > I added the following in SelectQuery.java :
    > ***************************************
    > //quick fix : property for setting the jdbc fetch size
    >
    > protected Integer cursorFetchSize;
    >
    > /**
    > * Gets the JDBC fetch size for this query.
    > *..eturn the fetch size defined for this query, null if not set.
    > */
    > public Integer getCursorFetchSize()
    > {
    > return cursorFetchSize;
    > }
    >
    >
    > /**
    > * Sets the JDBC fetch size for this query.
    > *..aram cursorFetchSize the desired fetch size, or null to reset
    > it.
    > */
    > public void setCursorFetchSize(Integer cursorFetchSize)
    > {
    > this.cursorFetchSize = cursorFetchSize;
    > }
    >
    > //end quick fix
    > ************************************
    >
    > And modified SelectAction.java to add the check in performAction :
    > public void performAction(Connection connection, OperationObserver
    > observer)
    > throws SQLException, Exception {
    >
    > long t1 = System.currentTimeMillis();
    >
    > SelectTranslator translator = createTranslator(connection);
    > PreparedStatement prepStmt = translator.createStatement();
    >
    > //quick fix : sets the fetch size
    > if( query.getCursorFetchSize() != null )
    > prepStmt.setFetchSize( query.getCursorFetchSize() );
    > //quick fix end
    >
    > ResultSet rs = prepStmt.executeQuery();
    > QueryMetadata md = query.getMetaData(getEntityResolver());
    >
    > (...)
    >
    > ********************************************************
    >
    >
    >
    >
    > --
    > View this message in context:
    > http://www.nabble.com/Big-selects-on-PostGres-%3A-Configuring-Statement.setFetchSize%28%29-of-a-selectquery-tp23555842p23635409.html
    > Sent from the Cayenne - User mailing list archive at Nabble.com.
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu May 21 2009 - 09:00:08 EDT