Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6571

groovy.sql.Sql.eachRow should set maxRows on the JDBC Statement

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.1
    • 2.3.1
    • SQL processing
    • None

    Description

      I noticed that executing groovy.sql.Sql.firstRow passes a maxRows parameter with value 1 to groovy.sql.Sql.eachRow. The maxRows value, however, is only used to limit ResultSet iteration.

      I believe JDBC drivers can optimize the data that is actually retrieved if the maxRows is set on the Statement prior to executing the SQL. If maxRows is not set, the driver may prefetch more results than is necessary and the database may end up doing more work.

      See http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#setMaxRows(int)

      Attachments

        Activity

          People

            paulk Paul King
            jstell Jason Stell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: