Thanks for the help.
You need to re-bind the variables with the id of the last row you get
back from the SELECT statement (the 10th row in this case). Also, you
only need to compare only the PK column in the WHERE clause, so you
could do something like this:
SELECT id, interfaceid FROM moninorlog WHERE id > ?
ORDER BY id LIMIT 10
This would allow you to step through your rows 10 at a time.
You could also step through them ordered by interfaceid since you have
a secondary index on it:
SELECT id, interfaceid FROM moninorlog WHERE (interfaceid,id) > (?,?)
ORDER BY interfaceid,id LIMIT 10
You need to include both interfaceid and id in the WHERE clause since
(presumably) interfaceid might repeat with the same value. The row
value constructor syntax, (i.e. listing more than one column, like
this: (?, ?,?) ) is only necessary if you have multiple PK columns.
The important part of this paging mechanism is that it provides for an
efficient way of "re-establishing" your cursor position.
On Wed, Jul 23, 2014 at 7:00 PM, Michael.Calvin <firstname.lastname@example.org> wrote:
> Using HBase 0.98-hadoop-1, phoenix 4.0.0-incubating.
> I have a table(named moninorlog, pk is id) created by phoenix with 13
> columns and 1 secondary-index(named interfaceid).
> Then I tried query like "SELECT id,interfaceid FROM moninorlog WHERE
> (id,interfaceid) > (?,?) ORDER BY id,interfaceid LIMIT 10".
> I ran this query twice in the same connection with same variables (even in
> same SreparedStatement object) , but they retuned the same results.
> Did I missed something?