phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sumit Nigam <sumit_o...@yahoo.com>
Subject Help with LIMIT clause
Date Thu, 10 Dec 2015 14:35:37 GMT
Hi,
The link for salted tables https://phoenix.apache.org/salted.html mentions "Since salting
table would not store the data sequentially, a strict sequential scan would not return all
the data in the natural sorted fashion. Clauses that currently would force a sequential scan,
for example, clauses with LIMIT, would likely to return items that are different from a normal
table"
So, would a simple query such as SELECT CURRENT_TIMESTAMP FROM TBL ORDER BY CURRENT_TIMESTAMP DESC
LIMIT 1; not really return the MAX(CURRENT_TIMESTAMP) ?
PK is on 2 columns with CURRENT_TIMESTAMP as the leading one. I am noticing this issue:
select current_timestamp from TBL order by current_timestamp desc limit 1;+------------------------------------------+|
           CURRENT_TIMESTAMP             |+------------------------------------------+|
1448815328556                            |+------------------------------------------+

select max(current_timestamp) from TBL;+------------------------------------------+|    
    MAX("CURRENT_TIMESTAMP")         |+------------------------------------------+|
1449732792090                            |+------------------------------------------+
The results are different. MAX is of course, returning the right record.
If this is the case, then what should be done where LIMIT is really to be used? What can I
replace it with to get the desired behavior?
Is this also correct that when there is a WHERE clause limiting the number of projected records,
then LIMIT seems to work fine? I seem to be noticing that also.
This is with hbase 0.98.14 and phoenix 4.5.x
Thanks,Sumit
Mime
View raw message