db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3825) StoreStreamClob.getReader(charPos) performs poorly
Date Tue, 14 Oct 2008 13:48:44 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639423#action_12639423

Knut Anders Hatlen commented on DERBY-3825:

Thanks for the updated patch, Kristian. I think it looks ready for

> Thanks for looking at the repositioning logic. It is a bit complex,
> but it should be pretty well tested functionally. Can it be
> optimized?

I don't see how it can be optimized without changing the format, since
random access to a lob is currently not supported by the store.

It may perhaps be easier to read it if the call to resetUTF8Reader()
is moved to the beginning of the method. Then there will be just two
cases to consider for the repositioning: the requested position is
either after the current position or in the buffer. This means that we
don't need the nested if statements. Something along these lines:

if (requestedCharPos <= readerCharCount - charactersInBuffer) {

long currentCharPos =
    readerCharCount - charactersInBuffer + readPositionInBuffer;

long difference = (requestedCharPos - 1) - currentCharPos;

if (difference <= 0) {
    // move back in the buffer
    readPositionInBuffer += difference;
} else {
    // skip forward

> StoreStreamClob.getReader(charPos) performs poorly
> --------------------------------------------------
>                 Key: DERBY-3825
>                 URL: https://issues.apache.org/jira/browse/DERBY-3825
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Store
>    Affects Versions:
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>         Attachments: derby-3825-0a-preview.diff, derby-3825-1a-reset_readpositioninbuffer.diff,
derby-3825-2a-internalReader_repositioning.diff, derby-3825-2a-internalReader_repositioning.stat,
> StoreStreamClob.getReader(charPos) performs poorly because it resets the underlying stream
and skips data until it reached the requested character position. Not only does the data has
to be skipped, it also has to be decoded (UTF-8).
> The problem is exposed through EmbedClob.getSubString, which causes extremely bad performance
for the client driver because the locator based Clob implementation uses this method.
> For the record, there is another read buffer size issue that exaggerates the problem
(it will probably be handled under DERBY-3769, and also DERBY-3818).

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message