Nosql – command such as SQL LIMIT in HBIT

Does HBase have any commands similar to SQL LIMIT queries?

I can execute through setStart and setEnd, but I don’t want to iterate all the rows.

From the HBase shell, you can use LIMIT:

hbase> scan'test-table', {'LIMIT' => 5}

Scan.setMaxResultSize(N) or scan.setMaxResultsPerColumnFamily(N) can be used from the Java API.

> HBase API docs – Scan.setMaxResultSize
> HBase API docs – Scan.setMaxResultsPerColumnFamily

Is there anything similar to SQL LIMIT in HBase? Order?

I can execute through setStart and setEnd, but I don’t want to iterate all the rows.

You can use LIMIT from the HBase shell:

hbase> scan'test-table' , {'LIMIT' => 5}

Scan.setMaxResultSize(N) or scan.setMaxResultsPerColumnFamily(N) can be used from Java API.

> HBase API docs – Scan.setMaxResultSize
> HBase API docs – Scan.setMaxResultsPerColumnFamily

Leave a Comment

Your email address will not be published.