You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kim Haase (Created) (JIRA)" <ji...@apache.org> on 2012/04/19 21:26:40 UTC

[jira] [Created] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Document performance issue with 2-arg versions of setXXXStream methods for LOBs
-------------------------------------------------------------------------------

                 Key: DERBY-5698
                 URL: https://issues.apache.org/jira/browse/DERBY-5698
             Project: Derby
          Issue Type: Improvement
          Components: Documentation
    Affects Versions: 10.8.2.2
            Reporter: Kim Haase
            Assignee: Kim Haase


The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.

Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Kim Haase (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kim Haase updated DERBY-5698:
-----------------------------

    Attachment: DERBY-5698-2.zip
                DERBY-5698-2.diff

I'm attaching a second patch with the changes I described, just so you can check them: DERBY-5698-2.diff and DERBY-5698-2.zip. 

                
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>         Attachments: DERBY-5698-2.diff, DERBY-5698-2.zip, DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272728#comment-13272728 ] 

Dag H. Wanvik commented on DERBY-5698:
--------------------------------------

Thanks, Kim. Looks good to me, but I am not familiar with the original performance issue here.

                
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>         Attachments: DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Kim Haase (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272738#comment-13272738 ] 

Kim Haase commented on DERBY-5698:
----------------------------------

Thanks, Dag! Yes, this is in Kristian's area of expertise so I'm hoping he'll take a look too.
                
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>         Attachments: DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Kim Haase (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kim Haase updated DERBY-5698:
-----------------------------

    Issue & fix info: Patch Available
    
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>         Attachments: DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13273070#comment-13273070 ] 

Kristian Waagan commented on DERBY-5698:
----------------------------------------

Derby uses a header to store length information for LOBs. If this header can't be filled in when the LOB is inserted, which will be the case if the LOB is inserted without specifying the length up front and the LOB is larger than a single page (typically 32 KB, but may be smaller too), Derby has no mechanism to update the header without rewriting the whole LOB at a later time.

The insert performance will be unaffected ([1]). You'll see impaired performance if you start asking for the length of these LOBs, as Derby has to fetch and decode the whole value to find the length.
If you're just reading data, say, with a stream, performance is unaffected.

Assuming you inserted 101 LOBs without specifying their lengths, 100 of them being 2 GB big and one only 10 bytes, you'd be in a world of hurt with the following query:
    select min(length(myLOBs)) from mytable

I think this can be fixed, but it will require some non-trivial work in the store.


[1] For recent versions, there were some edge-case issues with older versions using the client driver.
                
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>         Attachments: DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Kim Haase (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kim Haase resolved DERBY-5698.
------------------------------

          Resolution: Fixed
       Fix Version/s: 10.9.0.0
    Issue & fix info:   (was: Patch Available)

Committed patch DERBY-5698-3.diff to documentation trunk at revision 1338837.

                
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>             Fix For: 10.9.0.0
>
>         Attachments: DERBY-5698-2.diff, DERBY-5698-2.zip, DERBY-5698-3.diff, DERBY-5698-3.zip, DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Kim Haase (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kim Haase updated DERBY-5698:
-----------------------------

    Attachment: DERBY-5698-3.zip
                DERBY-5698-3.diff

Thank you, Kristian! I am attaching a third patch with the sentence about the pageSize property removed, and I'll commit it if/when I resolve my SSL problems. 
                
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>         Attachments: DERBY-5698-2.diff, DERBY-5698-2.zip, DERBY-5698-3.diff, DERBY-5698-3.zip, DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Kim Haase (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kim Haase updated DERBY-5698:
-----------------------------

    Attachment: DERBY-5698.zip
                DERBY-5698.stat
                DERBY-5698.diff

Attaching DERBY-5698.diff, DERBY-5698.stat, and DERBY-5698.zip, with changes to the following:

M       src/ref/rrefjavsqlprst.dita
M       src/ref/rrefjdbc4_0summary.dita

I added the following sentence to each topic:

"Omitting the length argument when the stream object is a LOB can impair performance, especially if the method is called repeatedly in an application or if the LOB is a large one."

Please let me know if any change is needed to this information. 
                
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>         Attachments: DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Kim Haase (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13273246#comment-13273246 ] 

Kim Haase commented on DERBY-5698:
----------------------------------

Thanks, Kristian! So would it be better to turn the sentence into a note that says something like the following?

"If you omit the length argument when the stream object is a LOB greater than a single page in size, performance will be impaired if you later retrieve the length of the LOB. However, if you are simply inserting or reading data, performance is unaffected. See the derby.storage.pageSize property for information about setting the page size."

Further tweaks welcome ...
                
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>         Attachments: DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (DERBY-5698) Document performance issue with 2-arg versions of setXXXStream methods for LOBs

Posted by "Kim Haase (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kim Haase closed DERBY-5698.
----------------------------


Changes have appeared in Latest Alpha Manuals.
                
> Document performance issue with 2-arg versions of setXXXStream methods for LOBs
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-5698
>                 URL: https://issues.apache.org/jira/browse/DERBY-5698
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.8.2.2
>            Reporter: Kim Haase
>            Assignee: Kim Haase
>             Fix For: 10.9.0.0
>
>         Attachments: DERBY-5698-2.diff, DERBY-5698-2.zip, DERBY-5698-3.diff, DERBY-5698-3.zip, DERBY-5698.diff, DERBY-5698.stat, DERBY-5698.zip
>
>
> The PreparedStatement.setAsciiStream and other methods have a 3-arg form that includes the length of the stream and a 2-arg form that does not. If the 2-arg form is used, Derby has to calculate the length every time the method is called. With LOBs, especially large ones, this can cause a major performance impact, especially if the method is called repeatedly. This should be documented where appropriate.
> Kristian, please feel free to correct or amplify anything I've said here.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira