You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2012/09/11 09:55:07 UTC

[jira] [Created] (OAK-300) Query: QueryResult.getRows().getSize()

Thomas Mueller created OAK-300:
----------------------------------

             Summary: Query: QueryResult.getRows().getSize() 
                 Key: OAK-300
                 URL: https://issues.apache.org/jira/browse/OAK-300
             Project: Jackrabbit Oak
          Issue Type: Task
          Components: core, jcr
            Reporter: Thomas Mueller
            Priority: Minor


The method QueryResult.getRows().getSize() is supposed to return the number of rows of the result, but can return -1 if the size is unknown. 

For both Jackrabbit 2.0 and Oak, in many cases, the size is unknown, because data is read on demand, possibly using a configurable fetch size to reduce the number of (network) roundtrips.

For Jackrabbit 2.0, as far as I'm aware the size is always available if 'order by' is used. This currently is also the case for Oak. However, in the future this might change as there is no need to read all data in memory if the index itself returns the data in the correctly sorted order.

For some existing applications, it might be a problem if getSize() returns -1 for those cases. For compatibility with Jackrabbit 2.0, and for ease of use, it would be good to have a clearly defined way to get the size of the result. For example using a configurable setting to define how many rows to fetch at most in case getSize() is called (if the end of the result has reached within the given fetch limit then getSize() can return the correct value; if not, getSize() returns -1). A possible way to configure such a setting is:

    SimpleCredentials cred = new SimpleCredentials(user, pwd.toCharArray());
    cred.setAttribute("queryFetchSizeLimit", "20");
    Session s = getRepository().login(cred);
    return s;

Another way to configure the setting is using an option within the query. We would have to invent a special syntax, as this doesn't doesn't seem to be the same as "limit" or "fetch size", maybe:

    select text from [nt:base] where id = $id fetch size limit 20

This ("fetch size limit 20") is somewhat similar to the SQL "fetch first
10 rows only" - http://en.wikipedia.org/wiki/Select_(SQL)#FETCH_FIRST_clause - but it's not the same really.

I don't consider this as a very urgent issue, but we need to keep it in mind.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-300) Query: QueryResult.getRows().getSize()

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13453830#comment-13453830 ] 

Thomas Mueller commented on OAK-300:
------------------------------------

As an alternative, introduce a new method getSize(int max) where the maximum return value is explicitly set.

* if called with max == -1
  * returns the exact size if quickly available,
  * returns -1 otherwise, and

* returns the exact size but not more then max when called with max >= 0.

                
> Query: QueryResult.getRows().getSize() 
> ---------------------------------------
>
>                 Key: OAK-300
>                 URL: https://issues.apache.org/jira/browse/OAK-300
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: core, jcr
>            Reporter: Thomas Mueller
>            Priority: Minor
>
> The method QueryResult.getRows().getSize() is supposed to return the number of rows of the result, but can return -1 if the size is unknown. 
> For both Jackrabbit 2.0 and Oak, in many cases, the size is unknown, because data is read on demand, possibly using a configurable fetch size to reduce the number of (network) roundtrips.
> For Jackrabbit 2.0, as far as I'm aware the size is always available if 'order by' is used. This currently is also the case for Oak. However, in the future this might change as there is no need to read all data in memory if the index itself returns the data in the correctly sorted order.
> For some existing applications, it might be a problem if getSize() returns -1 for those cases. For compatibility with Jackrabbit 2.0, and for ease of use, it would be good to have a clearly defined way to get the size of the result. For example using a configurable setting to define how many rows to fetch at most in case getSize() is called (if the end of the result has reached within the given fetch limit then getSize() can return the correct value; if not, getSize() returns -1). A possible way to configure such a setting is:
>     SimpleCredentials cred = new SimpleCredentials(user, pwd.toCharArray());
>     cred.setAttribute("queryFetchSizeLimit", "20");
>     Session s = getRepository().login(cred);
>     return s;
> Another way to configure the setting is using an option within the query. We would have to invent a special syntax, as this doesn't doesn't seem to be the same as "limit" or "fetch size", maybe:
>     select text from [nt:base] where id = $id fetch size limit 20
> This ("fetch size limit 20") is somewhat similar to the SQL "fetch first
> 10 rows only" - http://en.wikipedia.org/wiki/Select_(SQL)#FETCH_FIRST_clause - but it's not the same really.
> I don't consider this as a very urgent issue, but we need to keep it in mind.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Comment Edited] (OAK-300) Query: QueryResult.getRows().getSize()

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13453830#comment-13453830 ] 

Thomas Mueller edited comment on OAK-300 at 9/12/12 7:35 PM:
-------------------------------------------------------------

As an alternative, introduce a new method getSize(int max) where the maximum return value is explicitly set.

* if called with max == -1
  ** returns the exact size if quickly available,
  ** returns -1 otherwise, and

* returns the exact size but not more then max when called with max >= 0.

                
      was (Author: tmueller):
    As an alternative, introduce a new method getSize(int max) where the maximum return value is explicitly set.

* if called with max == -1
  * returns the exact size if quickly available,
  * returns -1 otherwise, and

* returns the exact size but not more then max when called with max >= 0.

                  
> Query: QueryResult.getRows().getSize() 
> ---------------------------------------
>
>                 Key: OAK-300
>                 URL: https://issues.apache.org/jira/browse/OAK-300
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: core, jcr
>            Reporter: Thomas Mueller
>            Priority: Minor
>
> The method QueryResult.getRows().getSize() is supposed to return the number of rows of the result, but can return -1 if the size is unknown. 
> For both Jackrabbit 2.0 and Oak, in many cases, the size is unknown, because data is read on demand, possibly using a configurable fetch size to reduce the number of (network) roundtrips.
> For Jackrabbit 2.0, as far as I'm aware the size is always available if 'order by' is used. This currently is also the case for Oak. However, in the future this might change as there is no need to read all data in memory if the index itself returns the data in the correctly sorted order.
> For some existing applications, it might be a problem if getSize() returns -1 for those cases. For compatibility with Jackrabbit 2.0, and for ease of use, it would be good to have a clearly defined way to get the size of the result. For example using a configurable setting to define how many rows to fetch at most in case getSize() is called (if the end of the result has reached within the given fetch limit then getSize() can return the correct value; if not, getSize() returns -1). A possible way to configure such a setting is:
>     SimpleCredentials cred = new SimpleCredentials(user, pwd.toCharArray());
>     cred.setAttribute("queryFetchSizeLimit", "20");
>     Session s = getRepository().login(cred);
>     return s;
> Another way to configure the setting is using an option within the query. We would have to invent a special syntax, as this doesn't doesn't seem to be the same as "limit" or "fetch size", maybe:
>     select text from [nt:base] where id = $id fetch size limit 20
> This ("fetch size limit 20") is somewhat similar to the SQL "fetch first
> 10 rows only" - http://en.wikipedia.org/wiki/Select_(SQL)#FETCH_FIRST_clause - but it's not the same really.
> I don't consider this as a very urgent issue, but we need to keep it in mind.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-300) Query: QueryResult.getRows().getSize()

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458552#comment-13458552 ] 

Thomas Mueller commented on OAK-300:
------------------------------------

Revision 1387516 (prefetch at least 20 and at most 100 nodes, timeout 0.1 seconds)
                
> Query: QueryResult.getRows().getSize() 
> ---------------------------------------
>
>                 Key: OAK-300
>                 URL: https://issues.apache.org/jira/browse/OAK-300
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: core, jcr
>            Reporter: Thomas Mueller
>            Priority: Minor
>
> The method QueryResult.getRows().getSize() is supposed to return the number of rows of the result, but can return -1 if the size is unknown. 
> For both Jackrabbit 2.0 and Oak, in many cases, the size is unknown, because data is read on demand, possibly using a configurable fetch size to reduce the number of (network) roundtrips.
> For Jackrabbit 2.0, as far as I'm aware the size is always available if 'order by' is used. This currently is also the case for Oak. However, in the future this might change as there is no need to read all data in memory if the index itself returns the data in the correctly sorted order.
> For some existing applications, it might be a problem if getSize() returns -1 for those cases. For compatibility with Jackrabbit 2.0, and for ease of use, it would be good to have a clearly defined way to get the size of the result. For example using a configurable setting to define how many rows to fetch at most in case getSize() is called (if the end of the result has reached within the given fetch limit then getSize() can return the correct value; if not, getSize() returns -1). A possible way to configure such a setting is:
>     SimpleCredentials cred = new SimpleCredentials(user, pwd.toCharArray());
>     cred.setAttribute("queryFetchSizeLimit", "20");
>     Session s = getRepository().login(cred);
>     return s;
> Another way to configure the setting is using an option within the query. We would have to invent a special syntax, as this doesn't doesn't seem to be the same as "limit" or "fetch size", maybe:
>     select text from [nt:base] where id = $id fetch size limit 20
> This ("fetch size limit 20") is somewhat similar to the SQL "fetch first
> 10 rows only" - http://en.wikipedia.org/wiki/Select_(SQL)#FETCH_FIRST_clause - but it's not the same really.
> I don't consider this as a very urgent issue, but we need to keep it in mind.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-300) Query: QueryResult.getRows().getSize()

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454771#comment-13454771 ] 

Thomas Mueller commented on OAK-300:
------------------------------------

To support the JCR getSize() method:

* always prefetch up to 20 nodes, and 
* if there is still time, fetch more up to 0.1 seconds or so, 
* or at most 200 nodes. 

I guess 200 should be enough to for a GUI to decide what to display (10 pages for 20 nodes per page).
                
> Query: QueryResult.getRows().getSize() 
> ---------------------------------------
>
>                 Key: OAK-300
>                 URL: https://issues.apache.org/jira/browse/OAK-300
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: core, jcr
>            Reporter: Thomas Mueller
>            Priority: Minor
>
> The method QueryResult.getRows().getSize() is supposed to return the number of rows of the result, but can return -1 if the size is unknown. 
> For both Jackrabbit 2.0 and Oak, in many cases, the size is unknown, because data is read on demand, possibly using a configurable fetch size to reduce the number of (network) roundtrips.
> For Jackrabbit 2.0, as far as I'm aware the size is always available if 'order by' is used. This currently is also the case for Oak. However, in the future this might change as there is no need to read all data in memory if the index itself returns the data in the correctly sorted order.
> For some existing applications, it might be a problem if getSize() returns -1 for those cases. For compatibility with Jackrabbit 2.0, and for ease of use, it would be good to have a clearly defined way to get the size of the result. For example using a configurable setting to define how many rows to fetch at most in case getSize() is called (if the end of the result has reached within the given fetch limit then getSize() can return the correct value; if not, getSize() returns -1). A possible way to configure such a setting is:
>     SimpleCredentials cred = new SimpleCredentials(user, pwd.toCharArray());
>     cred.setAttribute("queryFetchSizeLimit", "20");
>     Session s = getRepository().login(cred);
>     return s;
> Another way to configure the setting is using an option within the query. We would have to invent a special syntax, as this doesn't doesn't seem to be the same as "limit" or "fetch size", maybe:
>     select text from [nt:base] where id = $id fetch size limit 20
> This ("fetch size limit 20") is somewhat similar to the SQL "fetch first
> 10 rows only" - http://en.wikipedia.org/wiki/Select_(SQL)#FETCH_FIRST_clause - but it's not the same really.
> I don't consider this as a very urgent issue, but we need to keep it in mind.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (OAK-300) Query: QueryResult.getRows().getSize()

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

Thomas Mueller resolved OAK-300.
--------------------------------

    Resolution: Fixed
      Assignee: Thomas Mueller
    
> Query: QueryResult.getRows().getSize() 
> ---------------------------------------
>
>                 Key: OAK-300
>                 URL: https://issues.apache.org/jira/browse/OAK-300
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: core, jcr
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>
> The method QueryResult.getRows().getSize() is supposed to return the number of rows of the result, but can return -1 if the size is unknown. 
> For both Jackrabbit 2.0 and Oak, in many cases, the size is unknown, because data is read on demand, possibly using a configurable fetch size to reduce the number of (network) roundtrips.
> For Jackrabbit 2.0, as far as I'm aware the size is always available if 'order by' is used. This currently is also the case for Oak. However, in the future this might change as there is no need to read all data in memory if the index itself returns the data in the correctly sorted order.
> For some existing applications, it might be a problem if getSize() returns -1 for those cases. For compatibility with Jackrabbit 2.0, and for ease of use, it would be good to have a clearly defined way to get the size of the result. For example using a configurable setting to define how many rows to fetch at most in case getSize() is called (if the end of the result has reached within the given fetch limit then getSize() can return the correct value; if not, getSize() returns -1). A possible way to configure such a setting is:
>     SimpleCredentials cred = new SimpleCredentials(user, pwd.toCharArray());
>     cred.setAttribute("queryFetchSizeLimit", "20");
>     Session s = getRepository().login(cred);
>     return s;
> Another way to configure the setting is using an option within the query. We would have to invent a special syntax, as this doesn't doesn't seem to be the same as "limit" or "fetch size", maybe:
>     select text from [nt:base] where id = $id fetch size limit 20
> This ("fetch size limit 20") is somewhat similar to the SQL "fetch first
> 10 rows only" - http://en.wikipedia.org/wiki/Select_(SQL)#FETCH_FIRST_clause - but it's not the same really.
> I don't consider this as a very urgent issue, but we need to keep it in mind.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira