How to know how many rows a range contains?

39 views
Skip to first unread message

David

unread,
May 16, 2013, 6:08:29 AM5/16/13
to hyperta...@googlegroups.com
From METADATA table, we can know the StartRow and EndRow of a  range, but how to know how many rows there exists between StartRow and EndRow?

Doug Judd

unread,
May 16, 2013, 2:27:19 PM5/16/13
to hypertable-user
The only way to determine the number of rows in a range is to scan the range and count the rows.

- Doug


On Thu, May 16, 2013 at 3:08 AM, David <cwh...@gmail.com> wrote:
From METADATA table, we can know the StartRow and EndRow of a  range, but how to know how many rows there exists between StartRow and EndRow?

--
You received this message because you are subscribed to the Google Groups "Hypertable User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hypertable-us...@googlegroups.com.
To post to this group, send email to hyperta...@googlegroups.com.
Visit this group at http://groups.google.com/group/hypertable-user?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Doug Judd
CEO, Hypertable Inc.

David

unread,
May 16, 2013, 8:58:09 PM5/16/13
to hyperta...@googlegroups.com, do...@hypertable.com
If so , when executing 'select * from tab offset m limit n', how to offset row according the range infomation in the METADATA?

在 2013年5月17日星期五UTC+8上午2时27分19秒,Doug Judd写道:

Doug Judd

unread,
May 17, 2013, 3:41:19 AM5/17/13
to hypertable-user
That query essentially does the following:

select * from tab limit m+n;

And takes the last 'n' rows.

- Doug

David

unread,
May 18, 2013, 3:21:19 AM5/18/13
to hyperta...@googlegroups.com, do...@hypertable.com
I remember a fact Christoph said, when executing 'select * from tab offset m limit n',  the first m rows will be skipped according to the Range information in the client cache, then start  from the (m+1)th row to fetch the following n rows, is it right?
If so, how to know which range the (m+1)th row exists in? i.e. how to skip the first m rows if there is no a way to quickly calculate the rows in a range.

Doug Judd

unread,
May 18, 2013, 12:50:00 PM5/18/13
to hypertable-user
The query turns into SELECT * FROM tab LIMIT m+n;  Then under the hood, the client library will toss out the first m results and return the next n results.  The first m results are not skipped from information stored in a cache, they're skipped by streaming the results back from the RangeServers and skipping them.

- Doug



On Sat, May 18, 2013 at 12:21 AM, David <cwh...@gmail.com> wrote:
I remember a fact Christoph said, when executing 'select * from tab offset m limit n',  the first m rows will be skipped according to the Range information in the client cache, then start  from the (m+1)th row to fetch the following n rows, is it right?
If so, how to know which range the (m+1)th row exists in? i.e. how to skip the first m rows if there is no a way to quickly calculate the rows in a range.

--
You received this message because you are subscribed to the Google Groups "Hypertable User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hypertable-us...@googlegroups.com.
To post to this group, send email to hyperta...@googlegroups.com.
Visit this group at http://groups.google.com/group/hypertable-user?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

David

unread,
May 19, 2013, 9:05:37 PM5/19/13
to hyperta...@googlegroups.com, do...@hypertable.com
the client library will toss out the first m results and return the next n results.  
If i use the Thrift API and an additioal ThriftBroker, is the client library the ThriftBroker on an additional machine or Native library on the RangeServer?

Doug Judd

unread,
May 20, 2013, 9:56:11 AM5/20/13
to hypertable-user
The ThriftBroker uses the client library.

- Doug



On Sun, May 19, 2013 at 6:05 PM, David <cwh...@gmail.com> wrote:
the client library will toss out the first m results and return the next n results.  
If i use the Thrift API and an additioal ThriftBroker, is the client library the ThriftBroker on an additional machine or Native library on the RangeServer?

--
You received this message because you are subscribed to the Google Groups "Hypertable User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hypertable-us...@googlegroups.com.
To post to this group, send email to hyperta...@googlegroups.com.
Visit this group at http://groups.google.com/group/hypertable-user?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

David

unread,
May 25, 2013, 5:26:15 AM5/25/13
to hyperta...@googlegroups.com, do...@hypertable.com
Now i'm reading the source code about the offset and limit. I find that the client realizes the limit in the 'load' method of the 'hypertable/lib/ScanCell.cc' file,  but the codes to realize offset only exist in 'hypertable/rangeserver/MergeScannerRange.cc' file, such as:
         ......
          if (m_row_offset && m_row_skipped < m_row_offset) {
            m_skip_this_row = true;
            m_row_skipped++;
          } 
         ......
         if (m_skip_this_row)
               continue;
         .....
Two questions:
1. The code is executed on RangeServer, so i think that the skipped cells will not be send back to client, right?
2.  Are there still other codes to realize the offset in other files?  
Reply all
Reply to author
Forward
0 new messages